我的要求是从字符串中删除除下划线之外的所有特殊符号。我想从字符串中删除特殊符号,句点,连字符,下划线和数字 - PHP
我使用..
$string = '[email protected](text)text&text.text*text\text/text';
$columnName = preg_replace('/[^a-zA-Z0-9_ %\[\]\.\(\)%&-]/s', '_', $string);
输出:
text-text_text_text_text(text)text&text.text_text_text_text
但它不删除时期,符号,支架和仪表板。创建这个正则表达式时,我感到无助。请帮助..
'的preg_replace('/ [^ A-ZA-Z0-9 ] /','_',$ string);' – rabudde
嘿thanx ..它的工作..添加它作为答案il标记它是正确的。 –