Boost logo

Boost Users :

From: Andriy Tylychko \(mail.ru\) (telya_at_[hidden])
Date: 2006-09-08 14:01:53


> From: Roman Neuhauser [mailto:neuhauser_at_[hidden]]
> # telya_at_[hidden] / 2006-09-08 12:23:36 +0300:
> > Hi
> >
> > <http://www.boost.org/libs/regex/doc/syntax_perl.html>
> > http://www.boost.org/libs/regex/doc/syntax_perl.html says:
> >
> >
> > Perl Regular Expression Syntax
> >
> >
> > In Perl regular expressions, all characters match themselves except
> > for the following special characters:
> >
> > .[{()\*+?|^$
>
> > Q: what about "]}" symbols?
>
> They're only special if there's a matching "[" or "{"
> earlier in the
> pattern:
>
> > echo 'aaa]}]}]}bbb' | perl -pe 's/(]|})+//'
> aaabbb
> > echo 'aaa]}]}]}bbb' | perl -pe 's/[]}]+//'
> aaabbb
> > echo 'aaa}}}]]]bbb' | perl -pe 's/}+//;s/]+//'
> aaabbb
>

Moving this discussion from boost-users to boost-development...

Thanks for explanation, Roman.

I've checked this on boost v.1.33.1, but only unmatched "]" is allowed,
construction of boost::regex("}") claims unmatched "}". Is it by design or
already fixed in v.1.34?

I had to handle special characters, so I just "copy/paste"ed from docs. And
so, I didn't handle "}]". Do you think it's a good idea to expand
description of special characters in docs to include explanation about "}]"
characters?
As I checked, both unmatched "]" (and probably "}" in 1.34) and unmatched
but escaped "\}\]" are allowed and have the same effect. It was very useful
for me, so maybe it's worth to mention in docs too.

Thanks,
Andriy.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net