|
Posted by Rik on 06/20/07 08:35
On Wed, 20 Jun 2007 05:47:27 +0200, Phil Latio
<phil.latio@f-in-stupid.co.uk> wrote:
> Below is a function I've written for validating URLs.
> if(preg_match("/^[http://www.|www.][\S]+$/", $string))
--------------------------^
> However I keep getting the error message:
> Warning: preg_match() [function.preg-match]: Unknown modifier '/'
>
> What have I obviously missed?
That if you start a regex with '/', any '/' will end it, and the rest od
the string has to be interpreted as modifiers. You can use anything as a
modifier, so just use another character.
--
Rik Wasmus
Navigation:
[Reply to this message]
|