Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 08 Aug 2012, 16:43
chefy chefy is offline
 
Join Date: Jul 2012
Prevent special characters when registering an account

I only want to allow the following characters for nicknames when someone is registering an account at register.php:

a ... z
A ... Z
0 ... 9
underscore "_"

How can I achieve this?
Reply With Quote
  #2  
Old 08 Aug 2012, 16:50
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is online now
 
Join Date: Aug 2008
Real name: Simon
Use REGEX ^[a-zA-Z0-9äöüÄÖÜ]*$ read about it here http://www.regular-expressions.info/unicode.html
Reply With Quote
  #3  
Old 09 Aug 2012, 01:37
chefy chefy is offline
 
Join Date: Jul 2012
Originally Posted by Simon Lloyd View Post
^[a-zA-Z0-9äöüÄÖÜ]*$
Could you please explain what the bold snippet means? I guess that it will allow stuff like á à ó ò ú ù Á À Ó Ò Ú Ù? If so, why don't add vowels "e" "E" and "i" "I" to your regex?

Also I'd like to allow white spaces " " in nicknames (yes, the character you make when you press the spacebar button in your keyboard).

Last edited by chefy : 09 Aug 2012 at 01:49.
Reply With Quote
  #4  
Old 09 Aug 2012, 06:55
Simon Lloyd's Avatar
Simon Lloyd Simon Lloyd is online now
 
Join Date: Aug 2008
Real name: Simon
Did you read the link? the fact that a-z are allowed means every character between a AND z including a AND z are allowed.

The bold snippet is for foriegn characters.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Jump


New To Site? Need Help?

All times are GMT. The time now is 13:57.

Layout Options | Width: Wide Color: