Re: Quickform Validation rules for grouped elements
| From: | Bertrand Mansion | Date: | Tue, 27 May 2003 12:16:43 +0000 |
| Subject: | Re: Quickform Validation rules for grouped elements | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5613@lists.php.net to get a copy of this message | ||
<mcarter@quantiv.com> wrote :
>> Must be something wrong with your regex.
>
> As I didn't write the regex myself, it was published on a website I was
> pretty confident it wasn't a mess up in that which generated the PHP error:
>
> Warning: No ending delimiter '^' found in c:\php4\pear\HTML\QuickForm.php on
> line 1452
>
> This morning I generated a test using the same regular expression. See the
> code (try changing the url variable to test) :-
>
> <?php
> $url = "http://www.dogs.com";
>
> if(eregi('^(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*
> )?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*$', $url))
> {
> print "You have a valid URL!";
> } else {
> print "Your have a bad URL!";
> }
> ?>
>
> This works perfect with no warnings or errors. Because of this, I think
> there is something screwy going on with the way Quickform is handling or
> storing the regular expressions passed in as validation rules.
QuickForm uses perl regular expressions. In your case, you need to set the
delimiters as the error message says. Just enclose your expression between /
and /
Bertrand Mansion
Mamasam