Posted By

brandonjp on 11/13/12


regex url http regexp https

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Regular Expression for Matching URLs with or without http(s)

 / Published in: Regular Expression

thanks to...

  1. (?:(?:http|https):\/\/)?([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?
  3. RegExp: /(?:(?:http|https):\/\/)?([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi
  4. pattern: (?:(?:http|https):\/\/)?([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})\b(?:\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?
  5. flags: gi
  6. 1 capturing groups:
  7. group 1: ([-a-zA-Z0-9.]{2,256}\.[a-z]{2,4})

Report this snippet  

You need to login to post a comment.