|
Boost : |
From: tomthepom_at_[hidden]
Date: 2001-11-01 17:38:30
I'm hoping this is a quick 'You idiot, you know nothing about regular
expressions' problem.
I'm looking at stripping leading and trailing spaces off a string.
Why does the expression;
std::string file(" hello ");
boost::cmatch whatis;
boost::regex_match(file, whatis, boost::regex("^\\s*(.*?)\\s*$"));
match the leading spaces - i.e. it results in " hello", rather
than "hello" ?
The equivalent perl expression
s/^\s*(.*?)\s*$/$1/
is a standard, if inefficient way of stripping both leading and
trailing spaces.
What am I missing?
I'm using boost 1.25.0 on vc6sp4
Tom Platts-Mills
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk