RE: [PEAR] Quickform rules & documentation
| From: | Mike Carter | Date: | Wed, 21 May 2003 16:43:11 +0000 |
| Subject: | RE: [PEAR] Quickform rules & documentation | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-5515@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: xavier [mailto:xav@spotk.net]
>
> >Did I see somewhere that you can specify regular expressions to
> >validate form field content? I can't find any examples of it in use
> >now!
> >
> >I wanted to check if a URL was vaid using:
> >^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z
> 0-9]*)?/?(
> >[a-zA
> >-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$
> >
> >Regards,
> >
> >
> >
> Yep sure you can, with a line like:
> form->addRule('yourfield', 'your message', 'regex',
> '/^[a-zA-Z0-9!£\$%^&\(\)\[\]{}@]{1,20}$/');
Just as a side note - you can find loads of complex looking regular
expressions @ http://regexlib.com/
Might be useful for some Quickform users.
Regards,
Mike C
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.480 / Virus Database: 276 - Release Date: 5/12/2003
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________