Boost logo

Boost :

Subject: Re: [boost] [regex] Matching space - help needed
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-11-24 15:05:53


AMDG

Roman Yakovenko wrote:
> Hello.
>
> I have some strange problem and have no idea how to solve it or where
> to look father.
>
> I have two regular expressions:
>
> (\s)
>
> ( ) //<== this one contains single space between brackets.
>
> I use match algorithm and as a argument I pass string with single
> space. In the product, the first regular expression (\s) doesn't work,
> while the second does. I created stand-alone tester - both expressions
> work as expected.
>
> Using proc file system, I compared environment variables, specifically
> LANG is set to "en_US.UTF-8". Both executables load same Boost.Regex
> shared library. I am using GCC 3.3.3, on RedHat. The boost version is
> 1.34. Searching the web didn't help too.
>

If you said

boost::regex r("(\s)");

then you actually mean

boost::regex r("(\\s)");

note the two backslashes--the compiler strips one of them.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk