Regex problem

This is a discussion on Regex problem within the C++ Programming forums, part of the General Programming Boards category; I'm trying to strip some simple HTML tags out of a randomly selected piece of test HTML code. I'm trying ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Posts
    40

    Regex problem

    I'm trying to strip some simple HTML tags out of a randomly selected piece of test HTML code. I'm trying to use:

    Code:
    boost::match_results<std::string::const_iterator> what; 
    	
    	while(boost::regex_search(line, what, boost::regex("<[^<>]+>", oost::regex_constants::icase)))
    	{
    		cout<<what.str(1)<<endl;
    		
    		//Delete the first line from line
    		line = what.str(2);
    	}
    But that deletes everything. What am I doing wrong?

  2. #2
    Registered User
    Join Date
    Dec 2006
    Posts
    40
    I don't know why that was copied over incorrectly by the way. In the while statement, where I do boost::regex_constants::icase it really is correct. That's not the problem.

  3. #3
    Registered User
    Join Date
    Dec 2006
    Posts
    40
    If anyone is curious, I fixed the problem. I was missing the (...) around the regex. I hate dumb mistakes.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 04:46 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21