Boost logo

Boost Users :

From: John Maddock (john_at_[hidden])
Date: 2006-07-22 05:07:46


Winson Yung wrote:
>> Hello all, I have the following regular expression, but it doesn't
>> match to this text "REVENUE
>> ................................................... $10,481.1"
>>
>> const char* pattern[] = "Revenue[\s\.]*\$?\s*([0-9,\.]*)";

Don't you need to double up those escapes? Remember that C++ consumes the
first \ so you need \\ to pass an escape to the regex engine:

const char* pattern[] = "Revenue[\\s\\.]*\\$?\\s*([0-9,\\.]*)";

HTH, 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