CodeIgniter Forums
how do i validate a url? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: how do i validate a url? (/thread-21844.html)



how do i validate a url? - El Forum - 08-22-2009

[eluser]Shaheer[/eluser]
Hi,

i wanted to validate a url. Using PHP REGEX.

i have got some REGEXs by googling but all of them have flaws in them.

I wanted to match

all of these:
http://www.google.com
https://www.google.com
www.google.com
http://google.com
google.com/anything (or ?query )

but not javascript-: or mailto: can anyone help?

hey i am trying to type js protocol but expression-engine (the cms used here) removes it Big Grin


how do i validate a url? - El Forum - 08-22-2009

[eluser]Shaheer[/eluser]
no reply Sad


how do i validate a url? - El Forum - 08-22-2009

[eluser]sophistry[/eluser]
@shaheer... so, it looks like you waited 31 minutes to bump the thread - on a saturday. next time you might be more patient, especially with a problem that isn't directly CI related.

this page of this thread might help you parse URLs. let us know how it works out as this code should be in the auto_link function which would obviate your problem.

cheers.