It is currently Tue Sep 19, 2017 10:30 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: regexp for alphanumeric chars does not work
PostPosted: Sun Feb 24, 2013 5:50 pm 
Offline

Joined: Thu May 28, 2009 1:45 am
Posts: 3
I only want alphanumeric characters for one inputText field. Here is the validation code I'm using...
Code:
Array(
                'type'      => 'required',
                'regexp' => '/[a-zA-Z0-9]/',
                'help'      => 'Only permits alphanumeric characters.',
            ),

This does not work. I can use spaces, special characters, punctuation, just about anything in that field and the form will submit. What am I doing wrong? I am losing hours over this.

Thank you.


Top
 Profile  
 
 Post subject: Re: regexp for alphanumeric chars does not work
PostPosted: Mon Feb 25, 2013 11:41 pm 
Offline
Site Admin

Joined: Thu Jan 19, 2006 2:38 pm
Posts: 105
Hello!

It looks that the regexp you've tried to use is not exact enough.
A better solution would be: /^[0-9A-Za-z]+$/

Please give it a try!


Top
 Profile  
 
 Post subject: Re: regexp for alphanumeric chars does not work
PostPosted: Sat Mar 02, 2013 12:45 am 
Offline

Joined: Thu May 28, 2009 1:45 am
Posts: 3
Ok, I will try it and get back to you. Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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

Search for:
Jump to:  
cron
 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group