0

I have this regular expression which matches all http:// links

(http:\/\/[a-z0-9\.\/]+)/i

How do i modify it to include https:// links?

David Hariri
  • 928
  • 4
  • 15
  • possible duplicate of [What is the best regular expression to check if a string is a valid URL?](http://stackoverflow.com/questions/161738/what-is-the-best-regular-expression-to-check-if-a-string-is-a-valid-url) – Braj Aug 04 '14 at 16:56

2 Answers2

0

You need to add s after the string http and also add ? after s to make it optional

/(https?:\/\/[a-z0-9\.\/]+)/i
Avinash Raj
  • 166,785
  • 24
  • 204
  • 249
0

This will do:

https?:\/\/[a-z0-9\.\/]+
Harmen
  • 21,490
  • 3
  • 53
  • 74