Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2007-04-11 04:32:20


Jeff wrote:
> Dear forum members:
>
> I’m hoping that someone can copy and compile the code below and tell
> me what is wrong with my expression. I am trying to write a pattern
> that produces the following match and submatch:

If you want a set of patterns to be treated as alternatives then you need to
separate them with "|".

Also you need to double up the escapes on the \s to \\s : remember that the
C++ compiler will strip one \ so you need two of them if you want the regex
engine to see one.

So simply:

char exp[] = "<a href\\s*=\\s*\"(.*?)</a>";

would do what you want.

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