Problem with regular expression

Hello, The next few lines doesn't work (1) with \s. But (2) works well [[:space:]] regbase::escape_in_lists dont func? Someone it knows because? Thanks Javier --------------------------------------------------------------------- (1) void main() { regex exp("\s(ab)*",regbase::perl); cmatch what; if(regex_match(" ababab", what, exp)) { string str = what[0]; //this fail } } -------------------------------------------------------------------------------- (2) void main() { regex exp("[[:space:]](ab)*",regbase::perl); cmatch what; if(regex_match(" ababab", what, exp)) { string str = what[0]; //this succesfully match } } [Non-text portions of this message have been removed]

Hello, The next few lines doesn't work (1) with \s. But (2) works well [[:space:]]
If you want regex to see the escape within a string literal then remember that the C++ front end will process the escape sequence first, so you need "\\s". John.
participants (2)
-
Javier de Acha
-
John Maddock