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

/ Published in: Regular Expression
Save to your folder(s)

thanks to...

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.