开发者

ereg_replace to remove all non-alphanumerics is skipping square brackets [duplicate]

This question already has answers here: Difference between regex [A-z] and [a-zA-Z] (6 answer开发者_开发知识库s) Closed 4 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜