regex char not recognised

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
hi,all, I have the following regex:
<pre class="prettyprint const wregex postCodeUKPat(L"\s*\b([A-PR-UWYZa-pr-uwyz]([0-9]{1,2}|([A-HK-Ya-hk-y][0-9]|[A-HK-Ya-hk-y][0-9]([0-9]|[ABEHMNPRV-Yabehmnprv-y]))|[0-9][A-HJKS-UWa-hjks-uw]) {0,1}[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}|([Gg][Ii][Rr] 0[Aa][Aa])|([Ss][Aa][Nn] {0,1}[Tt][Aa]1)|([Bb][Ff][Pp][Oo] {0,1}([Cc]/[Oo] )?[0-9]{1,4})|(([Aa][Ss][Cc][Nn]|[Bb][Bb][Nn][Dd]|[BFSbfs][Ii][Qq][Qq]|[Pp][Cc][Rr][Nn]|[Ss][Tt][Hh][Ll]|[Tt][Dd][Cc][Uu]|[Tt][Kk][Cc][Aa]) {0,1}1[Zz][Zz]))\b\s*");
const wregex postCodeUSPat(L"^(d{5})|(d{5}-d{4})$");
const wregex foneNumUSPat(L"\s*([(]{1}[0-9]{3}[)]{1}[.| |-]{0,1}|^[0-9]{3}[.|-| ]?)?[0-9]{3}(.|-| )?[0-9]{4}\s*");
[/code]
after i built my project, i got the following warning msgs:
<pre class="prettyprint 1>XMLDOMFromVCDlg.cpp(6118): warning C4129: : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6118): warning C4129: : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6118): warning C4129: : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6118): warning C4129: : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6118): warning C4129: / : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6118): warning C4129: : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6118): warning C4129: : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6119): warning C4129: d : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6119): warning C4129: d : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6119): warning C4129: d : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: ( : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: ) : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: . : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: - : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: . : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: - : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: . : unrecognized character escape sequence
1>XMLDOMFromVCDlg.cpp(6120): warning C4129: - : unrecognized character escape sequence[/code]
<br/>
and i tried the following testing:
<pre class="prettyprint wstring wstrTxt25 = L"Phone: 312-573-0300";<br/>wstring wstrTxt30 = L"SWIV 2BJ";<br/>wstring wstrTxt31 = L"60611"; if(regex_search(wstrTxt30, postCodeUKPat))
{
m_strVIPSResult += CString(L"UK Postcode") + L"rn";
}

if(regex_search(wstrTxt31, postCodeUSPat))
{
m_strVIPSResult += CString(L"US Postcode") + L"rn";
}

if(regex_search(wstrTxt25, foneNumUSPat))
{
m_strVIPSResult += CString(L"US Phone Number");
} [/code]
<br/>
only "US Phone Number" can be recognised. whats going on here?
cheers

View the full article
 
Back
Top