Boost logo

Boost :

Subject: Re: [boost] [regex] [1.35]Problem with IPV6 validation windows XP
From: John Maddock (john_at_[hidden])
Date: 2008-10-20 08:39:55

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}(
>> \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


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.

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