Boost logo

Boost Users :

Subject: Re: [Boost-users] regex
From: John Maddock (john_at_[hidden])
Date: 2010-01-03 06:54:10


> Compilation fails with the following error:
>
> contact.cpp: In member function ‘virtual bool Contact::response()’:
> contact.cpp:48: error: unknown escape sequence '\s'
>
> The regex works fine with the \s removed (but of course replaces all
> spaces with underscores).

You need to use \\s as the escape is processed first by the compiler, and
then by the regex engine, so a string literal of "\\" produces a single \ to
be passed to the regex engine.

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