...

View Full Version : Allow space pregmatch



Anishgiri
05-04-2011, 03:22 AM
I have a preg match that allows valid characters, but how can allow middle spaces? Like for example University Of Insertname. Thanks.


preg_match("#^[A-Za-z']*$#",trim($schoolname)))

Inigoesdr
05-04-2011, 04:37 AM
preg_match("#^[A-Za-z' ]*$#",trim($schoolname)))
Or, if you want to include "any whitespace character" such as line feed, etc.:

preg_match("#^[A-Za-z'\s]*$#",trim($schoolname)))

Anishgiri
05-04-2011, 04:58 AM
Thanks for the answer this helps. :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum