Boost logo

Boost Users :

From: John Maddock (john_maddock_at_[hidden])
Date: 2002-07-29 05:38:21


> I have a small problem when trying out a regex that works ok with both
> jakarta (java code) and Perl. However, in boost::regex I get an extra
space
> that's very weird. This is the code:

boost.regex follows the POSIX lefmost longest rules for matching expressions
rather than the perl rules (yes you can have perl like syntax extentions,
but you can't change the underlying state matchine). Most of the time this
makes no difference, but sometimes it can bite you if you're used to perl's
rules. In this case it's finding a match for $2 that's more to the left
(and longer as it happens), than the match you were expecting. You might
find an expression such as:

"\\[(.+?)\\s*=\\s*([^\\s].*?)\\]"

would do what you want.

John Maddock
http://ourworld.compuserve.com/homepages/john_maddock/index.htm


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