Re: Quickform rules & documentation
| From: | xavier | Date: | Wed, 21 May 2003 16:44:07 +0000 |
| Subject: | Re: Quickform rules & documentation | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5513@lists.php.net to get a copy of this message | ||
Mike Carter wrote:
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-Z0-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}$/'); Regards -- Xavier