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]
|