[xpressive] Pattern problems (newbie)

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 "+) ") The regex are perl syntax, isn't? What is the regex for my IBIS Ver identifier? Thanks, Olaf

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
participants (2)
-
Eric Niebler
-
ope