/ Published in: Regular Expression

Matches are as follows:
0 = protocol
1 = fqdn
2 = subdomain
3 = top level subdomain
4 = domain (blah.com)
5 = port
6 = path
7 = query string
8 = hash
0 = protocol
1 = fqdn
2 = subdomain
3 = top level subdomain
4 = domain (blah.com)
5 = port
6 = path
7 = query string
8 = hash
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
^(http[s]?|ftp):\/?\/?((([^\.:\/\s]*\.?)*)\.([^\.:\/\s]+\.[^\.:\/\s]+)):?([0-9]+)?([\/\w\.+]*\/?)?\??([\w\-\.]+[^#?\s]+)?\??[^#]*#?([\w\-]+)?$
Comments
