How can I check for a plus sign using regular expressions?

后端 未结 2 1693
Happy的楠姐
Happy的楠姐 2020-12-21 03:52

I\'m trying to check for a plus sign using PHP and regular expressions.

Here is the code I got so far.

preg_replace(\'#[^-a-zA-Z0-9_&; ]#\', \'\'         


        
2条回答
  •  南笙
    南笙 (楼主)
    2020-12-21 04:39

    Add a + to the list.

    preg_replace('#[^-a-zA-Z0-9_&; +]#', '', $abcd)
    

提交回复
热议问题