speedy33417 Posted December 12, 2010 Share Posted December 12, 2010 My username validation works on these principals: First letter must be alphanumerical All other letters must be alphanumerical plus space and -_. I use the following code if (preg_match('/^[A-Za-z0-9][A-Za-z0-9-_.\s]/',$username)) ... The problem is that it validates this: xxxxx™ How can I make sure that my username does not accept trademark sign and similar characters? Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/221362-username-validation/ Share on other sites More sharing options...
requinix Posted December 12, 2010 Share Posted December 12, 2010 You know how you used ^ to mark the beginning of the string? Try using $ to mark the end of it too... Quote Link to comment https://forums.phpfreaks.com/topic/221362-username-validation/#findComment-1145999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.