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
  • 969
  • 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
  • 172,303
  • 28
  • 230
  • 274
0

This will do:

https?:\/\/[a-z0-9\.\/]+
Harmen
  • 22,092
  • 4
  • 54
  • 76