Boost logo

Boost Users :

From: Merrill Cornish (merrill.cornish_at_[hidden])
Date: 2005-08-01 21:17:28

I am using regex_match() from Boost 1.32.0. I am well famililar with Perl's regular expression, but I got a surprise from Boost's regex_match(). My basic code is

        static const regex CHAR(" char ");
        regex_match(newSpec, CHAR)

If newSpec is " char ", then it matches, of course. However, if newSpec is " char * ", it doesn't match. Hmmmm.

In my Perl experience, a regex of " char " says match those six characters if found ANYWHERE in newSpec. This would mean that a Boost regex of " char " would match a newSpec of " char * ", but it doesn't seem to.

If I change the regex to ".* char .*", then it matches, implying that Boost's regex of " char " is being treated as if it were Perl's "^ char $".

I could add the ".*" before and after each of my (many) regular exressions. However, I'm guessing there is a match_flag_type value which would do this for me. Unfortunately, none of the match constant descriptions seem to be what I need.

How should I write a Boost regex so that it would find " char " anywhere in the input string regardless of any prefix or suffix?


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at