Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

preg match php a-zA-Z0-9 and space

Tags:

php

if (preg_match ('/[^a-zA-Z0-9]/i', $getname)) {

i use this preg_match pattern to check if a string in php contains other charachters than a-zA-Z0-9. i want to add to the pattern the space...i use '/[^a-zA-Z0-9 ]/i' but is not working ... how should i do it?

i want to allow spaces including a-zA-Z0-9

like image 727
stefanosn Avatar asked Dec 17 '10 09:12

stefanosn


1 Answers

if (preg_match ('/[a-zA-Z0-9 ]/', $getname)) {
like image 50
yoda Avatar answered Sep 19 '22 21:09

yoda