Boost logo

Boost Users :

From: Anne-Gert Bultena (list-aap_at_[hidden])
Date: 2006-06-13 04:04:42


Hi,

This is not really an answer to your question (since I don't know either :-) ), but it might help
nonetheless. cr/lf are always a bit problematic (is it \n or \r\n, what's in the input string,
does the engine do platform dependent conversions, etc) and not really important in HTML since
it's just whitespace. For this reason, instead of matching a line-break, I match whitespace. This
also handles indentations correctly. Therefore, I'd use the pattern:

"</tr>\s*</table>\s*</td>\s*</tr>\s*</table>\s*</td>\s*</tr>\s*</table>"

good luck,

agb

> Can any one tell me how to specify "Multiline" search while using regex?
>
>
> e.g.
>
> std::string fb;
> // fb stores a fragment of html code, multiline;
> boost::regex
> pattern("</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>\r\n</td>\r\n</tr>\r\n</table>");
> boost::smatch res;
> boost::match_flag_type flags = boost::match_default;
> std::string::const_iterator s , e;
> s = fb.begin();
> e = fb.end();
> if(boost::regex_search(s, e, res, pattern, flags))
> {
> //process the match.
> }
> else
> {
> //I am always here
> }
>
> When I use some other regex tools to check the same target string and match
> pattern string, I always get the right thing as expected.
> How can I alter the option of boost::regex_search to satisfy the original
> request?
> thanks
>
> --
> This is my Very Signature. Ha, pretty good?
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net