Opened 12 years ago
Closed 12 years ago
#4608 closed Bugs (fixed)
boost::regex accepts invalid regular expressions like "\\d++"
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | regex |
Version: | Boost 1.44.0 | Severity: | Problem |
Keywords: | regex | Cc: |
Description
In programming languages that don't support possessive quantifier,eg. Python and C#,"\d++" is considered as an illegal nested quantifier.And in boost::xpressive,"
d++" will raise a runtime exception.However,it's valid in boost::regex.
wchar_t* s = L"abc123" ; wregex e(L"\\d+++", boost::regex::normal) ; wcmatch m ; if(regex_search(s, m, e)){ wcout << m[0] << endl ; }
The output is 123.
Change History (3)
comment:1 by , 12 years ago
comment:2 by , 12 years ago
Boost.Regex is intended to to track the regular expressions supported by Perl-5.x, and pocessive quantifiers were introduced in Perl-5.10 which is why we support them.
However, you are correct that three +'s sould raise an error - I'll fix that shortly.
comment:3 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Compiler:Visual C++ 2008