Forum Moderators: coopster

Message Too Old, No Replies

Validating an URL string

         

asantos

5:39 am on Nov 12, 2006 (gmt 0)

10+ Year Member



Hi,
i have a blog registration form and I need to validate the URL field.

A) For example, if user enters blablabla.com (wrong)
That should be [blablabla.com...] (right)

B) Also, if user enters ttp://blablabla.com (wrong)
That should be [blablabla.com...] (right)

Right now i am using parse_url to do the validation, but it doesnt help too much when "http://" is not entered. What could i do? Regexp? If yes, pls example.

mcavic

7:11 am on Nov 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



preg_match()

asantos

7:32 am on Nov 12, 2006 (gmt 0)

10+ Year Member



Any examples i can watch? im not very familiar to preg_match cases.

barns101

3:22 pm on Nov 12, 2006 (gmt 0)

10+ Year Member



The PHP manual page for preg_match() [php.net] lists examples.