
Hello All. I'm using the C++ library of boost RegEx. Long story short: I'm trying the expression (?<=<h1>).*?(?=</h1>) On the string <h1>hello there</h1> and the engine crashes (asserts in Kernel32(d).dll) Is this a known issue? here's my code snippet. std::vectorstd::string v; boost::RegEx expr( "<h1>hello there</h1>", TRUE); expr.Grep(v, "(?<=<h1>).*?(?=</h1>)" ); thanks for any help! - Per

Hello All.
I'm using the C++ library of boost RegEx. Long story short: I'm trying the expression
(?<=<h1>).*?(?=</h1>)
On the string <h1>hello there</h1>
and the engine crashes (asserts in Kernel32(d).dll)
Is this a known issue?
here's my code snippet.
std::vectorstd::string v; boost::RegEx expr( "<h1>hello there</h1>", TRUE); expr.Grep(v, "(?<=<h1>).*?(?=</h1>)" );
thanks for any help!
- Per
------------------------------------------------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users I'm a little confused by your capitalization - I have the following test cases (modified to resemble your example): TEST(test_boost_regex1) { std::string string_to_search="<html><body><h1>hello
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Per Franck wrote: there</h1></body></html>"; boost::smatch matched; boost::regex expression("<[hH]1>.*[hH]1>", true); if (boost::regex_search(string_to_search, matched, expression)) { std::cout << "Matched:" << matched << endl; } else { std::cout << "no match found" << endl; } } TEST(test_boost_regex2) { bool match_found=false; std::vectorstd::string v; v.push_back("<h1>hello there</h1>"); v.push_back("Hello world!"); v.push_back("<H1>Hi</H1>"); v.push_back("<h1>bye</h1>"); boost::regex expression("<[hH]1>.*[hH]1>", true); for (std::vectorstd::string::iterator it=v.begin(); it!=v.end(); ++it) { std::string string_to_search = *it; if (boost::regex_match(string_to_search, expression)) { std::cout << "This string matches:" << string_to_search << endl; match_found=true; } } if (!match_found) { std::cout << "no match found" << endl; } } -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iEYEARECAAYFAkhRej0ACgkQ/X5Z5iyVCbGP9wCePPTPNi2GU0DnPYzy0SZYaO/w tyAAniWu7Gg7EySx1P54k0bfMqt+RNz5 =n5hO -----END PGP SIGNATURE-----

Per Franck wrote:
Hello All.
I'm using the C++ library of boost RegEx. Long story short: I'm trying the expression
(?<=<h1>).*?(?=</h1>)
On the string <h1>hello there</h1>
and the engine crashes (asserts in Kernel32(d).dll)
Is this a known issue?
here's my code snippet.
std::vectorstd::string v; boost::RegEx expr( "<h1>hello there</h1>", TRUE); expr.Grep(v, "(?<=<h1>).*?(?=</h1>)" );
Runs just fine for me here with VC8: * What compiler are you using? * Are you letting Boost.Regex auto-select the correct library variant to link against? These kinds of issues are usually caused by selecting a binary-incompatible library variant. And finally... you have the strings the wrong way around, that should be: std::vectorstd::string v; boost::RegEx expr("(?<=<h1>).*?(?=</h1>)", TRUE); expr.Grep(v, "<h1>hello there</h1>" ); HTH, John.
participants (3)
-
John Maddock
-
Per Franck
-
Rupert Bruce