/ Published in: Regular Expression
thanks to...
http://gskinner.com/RegExr/
http://daringfireball.net/2010/07/improved_regex_for_matching_urls
http://gskinner.com/RegExr/
http://daringfireball.net/2010/07/improved_regex_for_matching_urls
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(?:(?:http|https):\/\/)?([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)? RegExp: /(?:(?:http|https):\/\/)?([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi pattern: (?:(?:http|https):\/\/)?([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)? flags: gi 1 capturing groups: group 1: ([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})