Boost logo

Boost :

From: Gavin Lambert (boost_at_[hidden])
Date: 2021-07-21 22:57:00


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk