I've built my own which at a first glance, satisfies many variants met in practice.
Here's the regular expression pattern, and the results ran on some test strings (some well-formed and some not well-formed URL's).
What do you think about it, if anybody tests this, please send some feedback.
Thanks,
Lucian Costin
TESTING WITH RegEX
^http\:\/\/([\w\d\-\.]+)\.([\w\d\-\.]+)($|\/|\?|\#|(\\[\w\d\:\#\@\%\/\;$\~\_\?\\+\-\=\\\.\&\,]+))
does not match http://
does not match http://123
does not match http://www
does not match http://www.
does match http://a.com
does match http://a.com??
does match http://www.a.com/a
does match http://www.a.com/a/b
does match http://www.a.com/a/b/a.php?a
does match http://www.a.com/aa.php?a
does match http://www.a.com/aa.php?a=b
does match http://www.a.com/aa.php?a=b#abcd
does match http://127.027.0.2
does match http://127.027.0.2#be
does match http://127.027.0.2/
does match http://127.027.0.2/a
does match http://127.027.0.2/a.php
does match http://127.027.0.2/a.php?a
does match http://127.027.0.2/?a
does match http://a.com?a
does match http://a.com#me
Niciun comentariu:
Trimiteți un comentariu