Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-08-08 06:29:05


John Maddock wrote:
> std::string escape_regex(const std::string& s)
> {
> static const std::regex e("[\\[\\]$\\^|.+*?(){}]");

std::regex - seems I missed something! :o)

> return regex_merge(s, e, "\\\\$&");
> }
>
> Just off the top of my head and untried....
>
> I'll try and think up something more general that works with all the flag
> settings though...

As I said, it's not a problem for me to write such a function. I just
think it should be part of the regex-library. This would allow a
complete implementation which is maintained and which might also be
tuned for performance as the above is obviously not the fastest
implementation available :)

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

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