ereg_replace to remove all non-alphanumerics is skipping square brackets [duplicate]
I have the following code that should strip all non-alphanumeric characters (excluding hyphens) from some text. It somehow misses square brackets somehow, however.
ereg_replace('[^A-z0-9-]', '', strtolower(str_replace(' ','-',$title)))
Can anyone advise?
I made a mistake and wrote A-z
instead of a-z
. A-z
encompasses the [
and ]
characters.
精彩评论