|
Re: [Regex] Maybe bug?: msg#00236lib.boost.user
> For example consider expression: > (www\.)?(.+?)\.com > When using match algorithm and try to match "www.somesite.com" $1 gets "www.somesite" but I thought it should be "somesite". Why (www\.)? is >ignored even when non greedy repeats are used? Works just fine for me, using the test code below: #include <iostream> #include "boost/regex.hpp" int main(int, char**) { boost::regex abc("(www\\.)?(.+?)\\.com"); std::string s("www.somesite.com"); boost::smatch what; boost::regex_match(s, what, abc); std::cout << (std::string)what[0] << std::endl << (std::string)what[1] << std::endl << (std::string)what[2] << std::endl; return 0; } John Maddock http://ourworld.compuserve.com/homepages/john_maddock/index.htm Info: <http://www.boost.org> Wiki: <http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl> Unsubscribe: <mailto:boost-users-unsubscribe@xxxxxxxxxxxxxxx> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Possible boost addition: sub string and const s tring.: 00236, Vincent Finn |
|---|---|
| Next by Date: | Re: regex+old_include on gcc 3.2: 00236, John Maddock |
| Previous by Thread: | [Regex] Maybe bug?i: 00236, Yaroslav Govorunov |
| Next by Thread: | regex+old_include on gcc 3.2: 00236, dreamlax |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |