| View previous topic :: View next topic |
| Author |
Message |
Zenith
Joined: 03 Jul 2007 Posts: 4
|
Posted: Wed Jun 04, 2008 4:42 pm Post subject: Quickform registerRule with regex query |
|
|
When it comes to regular expressions I'm a dunce.
I want to restrict one text field to:
a-z
A-Z
0-9
_ (underscore)
- (dash)
and space characters.
I thought the following would do the trick but its not playing ball.
| Code: |
$form->registerRule('alphanuma','regex','/^[a-zA-Z0-9:b-_]$/');
$form->addRule('title','Only the characters a-z, A-Z & 0-9 are valid','alphanuma');
|
Any pointers would be appreciated
Many thanks.
Z |
|
| Back to top |
|
 |
mark

Joined: 07 Jan 2007 Posts: 1053
|
Posted: Wed Jun 04, 2008 5:31 pm Post subject: |
|
|
What doesn't work? Examples?
And what do you expect to catch with ':b-_'? The dash needs to be escaped, BTW. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|