|
Boost Users : |
From: paul\.floyd (paul.floyd_at_[hidden])
Date: 2006-02-08 04:11:37
> Hi,
>
> I'm new to regex. This is basically what I was trying.
>
> #include <iostream>
> #include <boost/regex.hpp>
>
> int main()
> {
> std::string input = "sand._12";
> boost::regex reg(".*\._[0-9]+");
Hi
In C++, you need to double your escape characters, so that in
order to pass '.*\._[0-9]+' to the RE, you need to pass
'.*\\._[0-9]+' to the compiler.
With the string that you use, the compiler will strip the sole
backslash, and the RE will get '.*._[0-9]+', which isn't what
you want.
A+
Paul
Accédez au courrier électronique de La Poste : www.laposte.net ;
3615 LAPOSTENET (0,34 /mn) ; tél : 08 92 68 13 50 (0,34/mn)
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