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! 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... Link to comment https://forums.phpfreaks.com/topic/221362-username-validation/#findComment-1145999 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.