quick fix | February 12th, 2009

A regex that will check for any characters that are not in the list below and return true if any unknown characters are found

a-z
A-Z
0-9
_ (under-dash)
– (hypen)
(space)

$text = preg_replace(‘/[^a-zA-Z0-9_ -]/s’, , $text);

There are no comments yet, add one below.

Leave a Comment


You must be logged in to post a comment.