RE: [PEAR] Re: Registerrule(), regular expression for checking url
| From: | Mike Carter | Date: | Thu, 15 Apr 2004 15:49:55 +0000 |
| Subject: | RE: [PEAR] Re: Registerrule(), regular expression for checking url | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-11866@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Tommy Ipsen [mailto:tipsen@imada.sdu.dk]
>
> Ignatius Reilly wrote:
>
> > This is not a QF, but a REGEX mistake
> >
> > "/" is the regex boundary delimiter.
> > either choose another delimiter or escape instances of "/"
> inside the regex.
>
> Thanks - I ended up with something like this:
>
> $form->registerRule('url', 'regex',
> '/(^$)|(^(file|ldap|http|https|ftp):\/\/(([a-z0-9\-\.]+\.+[a-z
> ]{2,6})|([0-9]{1,3}\.){4})(\]?)$)/');
A good place to pick up pre-written Regular Expressions is:
http://regexlib.com/
Some nice URL ones there ;-)
Regards,
Mike C.
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________