Boost logo

Boost :

Subject: [boost] [regex] [1.35]Problem with IPV6 validation windows XP
From: Gopal_Haldar_at_[hidden]
Date: 2008-10-21 00:51:37

Please can you send me the proper regular expression which will accept
only all different type of valid IPv6 IP.
-----Original Message-----
From: boost-bounces_at_[hidden]
[mailto:boost-bounces_at_[hidden]] On Behalf Of John Maddock
Sent: Monday, October 20, 2008 6:10 PM
To: boost_at_[hidden]
Subject: Re: [boost] [regex] [1.35]Problem with IPV6 validation windows

Gopal_Haldar_at_[hidden] 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: 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}(
>> ){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


part, but that can't match because your string uses "." as a separator
between numbers, where as the expression only works with ":" as a

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:

Boost list run by bdawes at, gregod at, cpdaniel at, john at