Re: [boost] [regex] [1.35]Problem with IPV6 validation windows XP

I am waiting for reply. Please let me know is it possible through boost or not. -----Original Message----- From: Haldar, Gopal Sent: Thursday, October 16, 2008 4:01 PM To: 'boost@lists.boost.org' Subject: [boost] [regex] [1.35]Problem with IPV6 validation windows XP passing any IPV6 IP But it is failed to validate ::ffff:12.12.12.12 format... Please see my code... bool IsValidIPv6String(wstring ipv6address) { wsmatch what; wregex expression(L"^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1, 4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0 -9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa -f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1, 4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(( [0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b) \\.){3}(\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b))|(([0-9A-Fa-f] {1,4}:){0,5}:((\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b)\\.){3}( \b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}: ){0,5}((\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b)\\.){3}(\b((25[ 0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa -f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{ 1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$"); if(regex_match(ipv6address, what, expression)) { // what[0] contains the whole string // what[1] contains the response code // what[2] contains the separator character // what[3] contains the text message. //if(msg) // msg->assign(what[3].first, what[3].second); return true; } return false; } -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of John Maddock Sent: Thursday, October 16, 2008 2:30 PM To: boost@lists.boost.org Subject: Re: [boost] [regex] [1.35]Problem with IPV6 validation windows XP Gopal_Haldar@McAfee.com wrote:
Hi I am using the regex library for checking the IPV6 validation. Same expression I am using for javascript regular expression verification. But for IP format ::ffff:12.12.12.12 javascript regex api returing valid IP and boost regex_match method returning invalid IP(Windows XP). Please help me to identify the problem.
You're going to have to provide much more information: The exact regular expression used, The string you're matching against, and if possible the code you're using. Thanks, John. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Gopal_Haldar@McAfee.com wrote:
Please let me know is it possible through boost or not.
Apologies, I missed that message.
passing any IPV6 IP But it is failed to validate ::ffff:12.12.12.12 format... Please see my code...
bool IsValidIPv6String(wstring ipv6address) { wsmatch what;
wregex expression(L"^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1, 4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0 -9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa -f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1, 4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(( [0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b) \\.){3}(\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b))|(([0-9A-Fa-f] {1,4}:){0,5}:((\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b)\\.){3}( \b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}: ){0,5}((\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b)\\.){3}(\b((25[ 0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa -f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{ 1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$");
I don't see how any of the alternatives in that regular expression can match the string you give: the only alternative that could possibly match appears to be the "|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})" part, but that can't match because your string uses "." as a separator between numbers, where as the expression only works with ":" as a separator. Which part of the regex did you expect should match? Also did you intend the \b's to be literal bell characters, or \\b's and hense regular expression operators (word boundaries)? HTH, John.
participants (2)
-
Gopal_Haldar@McAfee.com
-
John Maddock