PHP Preg-Replace more than one underscore

前端 未结 8 1399
难免孤独
难免孤独 2020-12-17 03:22

How do I, using preg_replace, replace more than one underscore with just one underscore?

8条回答
  •  情书的邮戳
    2020-12-17 04:07

    Actually using /__+/ or /_{2,}/ would be better than /_+/ since a single underscore does not need to be replaced. This will improve the speed of the preg variant.

提交回复
热议问题