Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2004-07-21 05:09:24


> compiling "a{7}" or any repeat with curly brackets gives me an "invalid
> regex synyax"! Any clues or workarounds?
>
> Then
> boost::regex expression("GO:(\d+)",regex::bk_refs);
> string str=boost::regex_replace("GO:000015|GO:00016",expression,"$1")
> str equals "00001500015|00016" instead of the expected "000015|00016"!?
> I constructed a workaround for the latter problem with an explicit loop
over
> regex_iterator and such but this not really handy...
>
> Thanx for any feedback!!

You need to tell regex what kind of expression it is, it defaults to
something like POSIX basic syntax (which doesn't support {}) unless you add
in the necessary flags, so I guess what you really meant was either:

boost::regex expression("GO:(\d+)",regex::perl);
or
boost::regex expression("GO:(\d+)",regex::extended|regex::bk_refs);

John.


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