
Please can you send me the proper regular expression which will accept only all different type of valid IPv6 IP. Regards Gopal -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of John Maddock Sent: Monday, October 20, 2008 6:10 PM To: boost@lists.boost.org Subject: Re: [boost] [regex] [1.35]Problem with IPV6 validation windows XP 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. _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost