Reply to Re: preg_match function for URLs

Your name:

Reply:


Posted by Michael Fesser on 06/21/07 13:23

..oO(Phil Latio)

>Thanks for that. I am not really familiar regular expressions yet but well
>written ones seem quite useful.

There's another error in your pattern:

/^[http://www.|www.][\S]+$/

The first part creates a character class, which simply means to match
one of the characters [htp:/w.|]. Use parentheses instead to create a
subpattern, use another delimiter and maybe the /i modifier:

#^(http://www\.|www\.)[\S]+$#i

or try

#^(https?://)?www\.[\S]+$#i

But validating an entire URL is a bit more complex ...

Micha

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация