941,522 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 838
  • C++ RSS
May 4th, 2009
0

Regex Split problem, probably a no brainer.

Expand Post »
Hi All,

I've got a VC++ dll with Boost 1_34_1 regular expressions in it. I am a programmer but not VC++ or Regex.

The program worked fine until the target HTML format (sPage) was changed and I need to get the regexs updated. I got them updated OK. I checked them all with RegexBuddy and individually, they all work. I substituted the old regexs for the new but now after the regex split command the output-iterator (oMessageInfo) contains only the output of the first regular expression.

I looked at the Boost docs website ( http://www.boost.org/doc/libs/1_31_0...gex_split.html ) regarding the regex_split command

"Effects: Each version of the algorithm takes an output-iterator for output, and a string for input. If the expression contains no marked sub-expressions, then the algorithm writes one string onto the output-iterator for each section of input that does not match the expression. If the expression does contain marked sub-expressions, then each time a match is found, one string for each marked sub-expression will be written to the output-iterator."

Unfortunately I have no idea what a 'marked sub-expression' is.

Hoefully someone here can spot the schoolboy mistake.


C++ Syntax (Toggle Plain Text)
  1. const std::string sMessages1 =
  2.  
  3. "<td class=\"msgnumh smalltype\">\#([0-9]*)<\/td>"
  4. "(?:[\s\S]*?)From:(?:<\/em>)?(?:<\/span>)?(?:[\s]*)?(?:&quot;)?([^&]*)(?:&quot;)?(?:[\s]*)?&lt;([^&]*)&gt;"
  5. "(?:[\s\S]*?)Date:(?:<\/em>)?(?:<\/span>)?[\s]*([^<]*)(?:<br>)?"
  6.  
  7.  
  8. boost::regex oRegExMessages1(sMessages1, boost::regbase::normal | boost::regbase::icase);
  9.  
  10. boost::regex_split(std::back_inserter(oMessageInfo), sPage, oRegExMessages1);


Cheers,

Wilson.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
evildrome is offline Offline
1 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Multiple inheritance and cross-class type casting
Next Thread in C++ Forum Timeline: Counting repeated letters





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC