PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Quickform registerRule with regex query

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML
View previous topic :: View next topic  
Author Message
Zenith



Joined: 03 Jul 2007
Posts: 4

PostPosted: Wed Jun 04, 2008 4:42 pm    Post subject: Quickform registerRule with regex query Reply with quote

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
View user's profile Send private message
mark



Joined: 07 Jan 2007
Posts: 1013

PostPosted: Wed Jun 04, 2008 5:31 pm    Post subject: Reply with quote

What doesn't work? Examples?

And what do you expect to catch with ':b-_'? The dash needs to be escaped, BTW.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> HTML All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
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



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software