Apr 18 at 11:01pm, Andy Ladouceur wrote: > Andy Amol wrote: > > I would like to test whether a given sting contains only character, it > > should also support spaces. eg "Course Book String". I am able to test > > "CourseBookString". Also I would like to know how can we avoid wild > > chars like *, or any other char apart from alpha numeric char. > > A regexp like this should work: > /^([a-zA-Z]|\s)+$/
/^[A-Za-z\s]+$/ would be a better way of putting it. however, \s would match tabs (also CR and/or LF in some regex engines). to only alpha or space, this would work best: /^[A-Za-z ]+$/ -- Kelly Hallman -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php