CodeIgniter Forums

Full Version: how do i validate a url?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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

El Forum

[eluser]Shaheer[/eluser]
no reply Sad

El Forum

[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.