我想知道是否有人知道一个有很多正则表达式示例的网站?
我该如何修改这个声明白色,以我的理解只允许字母数字和空格,还包括:,.?! `'" ;: -_=+ /| @#$%^&*
$output = preg_replace("/[^A-Za-z0-9 ]/", "", $input);
This website - www.regular-expressions.info/tutorial.html provides systematic way of learning RegExp. You can also use expresso to practice regex....however the usablity of regex defers from language to language. This website - www.regular-expressions.info/tutorial.html provides you a good base.
该模式本身不允许字母、数字和空格,但该命令会删除任何“允许”的内容,因此该命令只留下这些字符。无论如何,这也将包括其他字符:
$output = preg_replace('/[^A-Za-z0-9 ,.?!`\'";:_=+\/|@#$%^&*-]/', "", $input);
查看本网站的教程和示例部分!