$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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