|
Boost Users : |
Subject: Re: [Boost-users] Problem with regular expression's validity and matching
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-02-23 21:56:20
AMDG
Paulino De Assis Fong wrote:
> I have two problems that I would need some help. Thanks in advance.
>
> Question 1:
>
> Please consider the regular expression to match US phone number below:
>
> ((\(\d{3}\)?)|(\d{3}))([\s-./]?)(\d{3})([\s-./]?)(\d{4})
>
> boost doesn't like it and it will throw an exception for the code below while
> it seems to be fine in online regex tester and .Net Regex library. I don't
> know what is imcompatiable with boost regex library. Please advice.
>
How do you create the regex?
std::wstring
csRegex(L"((\(\d{3}\)?)|(\d{3}))([\s-./]?)(\d{3})([\s-./]?)(\d{4})")
won't work because the \'s are handled by the compiler before
they get to the regex library.
In Christ,
Steven Watanabe
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