Jump to content

[SOLVED] regex for username


shadiadiph

Recommended Posts

mm this one ~[\w\.]+~ allows for spaces in the middle and charachters such as ! @

 

this one seems to work using trim /^\w+$/ but it doesn't allow . dots but not to worry.

 

thanks MasterAce and Crayon Violent for your input

 

Actually what it does is match on any one or more letter, number or dot in the string, regardless of where in the string it is.  It has the happy side-effect of what you mentioned.  Sorry, I forgot about the whole ONLY have that stuff in the string.

 

~^[\w\.]+$~

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.