I would have thought that '-' would only get confused as a range
specifier when it follows an opening atom. Here it follows a closing
atom (the '9' in 0-9').
I did not think for example that "a-g-z" could possibly be equivalent
to "a-z", that it should only be able to match a, b, c, d, e,f ,g '-'
and 'z'.
On 7/21/21, Gavin Lambert via Boost
On 22/07/2021 3:19 am, Phil Endecott wrote:
Here's an example of the sort of thing I have:
if (!regexp_match(s, regex("[A-Za-z0-9-_/]{1,8192}"))) throw MalformedInput();
The Javascript equivalent seems to be fine. In C++, with libstdc++'s regex implementation, it seems to take about 2 seconds to run. Boost.Regex didn't like the '-' after the '9' but when I fixed that the execution time became negligible. Boost.Xpressive seems also to be fast.
In pretty much all regexp languages, if you want to match '-' inside a character set then you must specify it as the first character (immediately following the '['), otherwise it is confused as a range specifier.
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
-- Soronel Haetir soronel.haetir@gmail.com