|
Boost : |
From: Michael Goldshteyn (mgoldshteyn_at_[hidden])
Date: 2007-03-21 14:54:14
"SourceForge.net" <noreply_at_[hidden]> wrote in message
news:E1HTz9p-0006qo-ID_at_sc8-sf-web21.sourceforge.net...
> Bugs item #1685103, was opened at 2007-03-21 06:39
> Message generated for change (Tracker Item Submitted) made by Item
> Submitter
> You can respond by visiting:
> https://sourceforge.net/tracker/?func=detail&atid=107586&aid=1685103&group_id=7586
>
> Please note that this message will contain a full copy of the comment
> thread,
> including the initial issue submission, for this request,
> not just the latest update.
> Category: regex
> Group: None
> Status: Open
> Resolution: None
> Priority: 5
> Private: No
> Submitted By: krankurs (krankurs)
> Assigned to: John Maddock (johnmaddock)
> Summary: regex_match throws exception
>
> Initial Comment:
> Running:
> MS Windows XP with pack 2, boost_1_33_1,
> MS VS 2005, VC++ console app,
> BOOST_REGEX_DYN_LINK;
> Multi-threaded Debug DLL (/MDd)
>
>
>
> boost::regex
> site_url_regex("http(s?)://((\b(?:\d{1,3}\.){3}\d{1,3}\b)|(www(.[a-z0-9]+)+.mydomain.com))");
>
>
> boost::regex_match("http://www.appwebsite1.mydomain.com", site_url_regex);
>
> returns true; (as expected)
>
> boost::regex_match("http://www.appwebsite1.mydomain.com/1234",
> site_url_regex);
>
> returns false; (as expected)
>
> boost::regex_match("http://www.appwebsite1.mydomain.com/12345678/12345678/",
> site_url_regex);
>
> throws exception, - expected false
>
> Thank you,
> Leonid
Other than the escape characters not being escaped in the example above,
correct code follows:
--- boost::regex site_url_regex("http(s?)://((\\b(?:\\d{1,3}\\.){3}\\d{1,3}\\b)|(www(.[a-z0-9]+)+.mydomain.com))"); boost::regex_match("http://www.appwebsite1.mydomain.com/12345678/12345678/", site_url_regex); --- ... this actually does highlight an apparent bug/deficiency. A much simpler example is given below: --- boost::regex test_regex("(?:.[a-z0-9]+)+"); boost::regex_match("www.appwebsite1.mydomain.com/1/1/", test_regex); --- This throws the same exception, at least in a VC 8.0 build using the DLL version of the reg-ex lib (debug), in perl_matcher_non_recursive.hpp at line 164 (raise_error(traits_inst, regex_constants::error_space);), because the state_count is 107429 and the max_state_count is 107425. Michael Goldshteyn
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk