Simple preg_replace

后端 未结 4 959
终归单人心
终归单人心 2021-02-05 13:06

I cant figure out preg_replace at all, it just looks chinese to me, anyway I just need to remove \"&page-X\" from a string if its there.

X

4条回答
  •  天涯浪人
    2021-02-05 13:07

    preg_replace uses Perl-Compatible Regular Expression for the search pattern. Try this pattern:

    preg_replace('/&page-\d+/', '', $str)
    

    See the pattern syntax for more information.

提交回复
热议问题