PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_QuickForm » Bug #609

No ending delimiter '^' found

Details

Submitted2004-01-22 13:32 UTC
Fromsergio at variograma dot com
StatusBogus
PackageHTML_QuickForm
PHP Version4.3.4
Roadmaps(Not assigned)

Comments

[2004-01-22 13:32 UTC] sergio at variograma dot com

Description:
------------
Maybe i'm doing something wrong here (which is likely, since this feature is poorly documented), but i get a warning when i try to use a regex rule that i had registered previously. I registered it the following way:

$form->registerRule("numcheck", "regex", "^[0-9]{4}$");

When i try to use it, i get a

Warning: No ending delimiter '^' found in /usr/lib/php/HTML/QuickForm/Rule/Regex.php on line 57

notice. I wanted to check if the user input is made of exactly four numbers, by the way.

[2004-01-22 13:44 UTC] mansion at php dot net

Use this instead:
$form->registerRule("numcheck", "regex", "/^[0-9]{4}$/");

When using regexes, you must add the delimiters before and after your regex, usually / (see PERL regular expressions).