Re: Validating URIs by regexp

On 2014/12/23 15:59, "Martin J. Dürst" wrote:

>>>> That is indeed a regular expression.  I'll even grant that it seems
>>>> likely to handle valid URIs correctly.  My concern is that it also
>>>> processes a large number of invalid URIs, for example:
>>>> "http://192.168.0.257"

>> I base my assertion that this is not a valid URI based on the following
>> quote from RFC 3986:
>>
>>        IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet
>>
>>        dec-octet   = DIGIT                 ; 0-9
>>                    / %x31-39 DIGIT         ; 10-99
>>                    / "1" 2DIGIT            ; 100-199
>>                    / "2" %x30-34 DIGIT     ; 200-249
>>                    / "25" %x30-35          ; 250-255
>>
>> Do you come to a different conclusion?
>
> No, of course not. The '7' in '257' doesn't match %x30-35.

Just for the record:
Björn was correct that this matches the reg-name production.

Regards,   Martin.

Received on Tuesday, 23 December 2014 07:57:13 UTC