Re:In search of the perfect URL validation regex
by lazyloop on Sunday June 22, 2014 @08:12PM
(#7929628)
You do realize that RFC 3986 actually contains an official regular expression, right? http://tools.ietf.org/html/rfc3986#appendix-B
[ Parent
| on HN ]
Re:In search of the perfect URL validation regex
by mathias on Monday June 23, 2014 @03:12AM
(#7930623)
You do realize that RFC 3986 doesn’t actually match reality, right? http://url.spec.whatwg.org/#goals
Re:In search of the perfect URL validation regex
by TazeTSchnitzel on Sunday June 22, 2014 @08:13PM
(#7929630)
That's for parsing a "well-formed" URI, not validating a URI as well-formed in the first place, however :)
Re:In search of the perfect URL validation regex
by saraid216 on Sunday June 22, 2014 @08:18PM
(#7929636)
That doesn't work for validation.
Re:In search of the perfect URL validation regex
by lazyloop on Sunday June 22, 2014 @09:32PM
(#7929777)
Of course it does, if that regular expression matches we have a valid URI. It's silly what gets downvoted on HN these days.
Re:In search of the perfect URL validation regex
by zAy0LfpBZLC8mAC on Sunday June 22, 2014 @10:13PM
(#7929871)
No, it doesn't. This regular expression matches strings that are not URIs, and that should be quite obvious if you compare the grammar in that same RFC to the regex.
Re:In search of the perfect URL validation regex
by lazyloop on Monday June 23, 2014 @12:49AM
(#7930301)
Yes, it does. And it is quite obvious if you compare the grammar to the regular expression.
Re:In search of the perfect URL validation regex
by zAy0LfpBZLC8mAC on Monday June 23, 2014 @01:07AM
(#7930349)
Please show how to produce the following string (which is matched by that regex) from the grammar (without the quotes):
"%x"
(edit: actually, feel free to do it with the quotes included if you like, that would still be matched by that regex)