Home » HTML » HTML_QuickForm » Bug #609
No ending delimiter '^' found
Details
| Submitted | 2004-01-22 13:32 UTC |
|---|---|
| From | sergio at variograma dot com |
| Status | Bogus |
| Package | HTML_QuickForm |
| PHP Version | 4.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).