How to allow space in input form
I am trying to build site with custom script. I have problem with allowing space in Name input field. If i include space, it will give error but if input slash or under开发者_运维技巧score, it accepts.
my name - i am getting not allowed error
my_name - i am getting success message.code
if(!preg_match('/^[0-9a-zA-Z\xe0-\xef\x80-\xbf._-]+$/i',$nickname)) {
You need to add \s for space to your regex.
I have try this :
[0-9a-zA-Z\xe0-\xef\x80-\xbf._-]+\s*
For debugging regex may be you can use this tools.
精彩评论