Boost logo

Boost Users :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-02-14 18:04:30


ope wrote:
> Hi,
>
> I'try to build a regex for an ibis file, the line I'm interested looks like:
>
> [IBIS Ver] 3.2 | Used for template variations"
>
> where '|' is an optional comment identifier with the (therefore
> optional) comments follows. I'm interested in the version self: "3.2" to
> create a parser using a factory.
>
> Using egrep '^\[IBIS Ver]' success.
>
> From docs I tested the dynamic regex
>
> $ perl -p -e '(\\w+) (\\w+)!' "Hello World"
>
> which fails (syntax error at -e line 1, near "+) ")

This isn't really an xpressive question, is it? In perl, regexes must be
enclosed in forward slashes. Try: /(\w+) (\w+)!/. But that's not how it
works in C++.

> The regex are perl syntax, isn't? What is the regex for my IBIS Ver
> identifier?

In C++ or in perl? The regex would look something like: \[IBIS
Ver\]\s+((\d+)\.(\d+))

In C++ you would double up the backslashes. In perl, you'd surround it
in forward slashes.

HTH,

-- 
Eric Niebler
Boost Consulting
www.boost-consulting.com

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