PHP, nested templates in preg_replace

前端 未结 4 1509
广开言路
广开言路 2021-01-13 21:41
preg_replace(\"/\\[b\\](.*)\\[\\/b\\]/Usi\", \"$1\", \"Some text here... [b][b]Hello, [b]PHP![/b][/b][/b] ... [b]and here[/b]\");
         


        
4条回答
  •  独厮守ぢ
    2021-01-13 22:35

    Why use regex for this particular case? You could get away with a simple string replace every [b] to strong and every [/b] to the /strong.

提交回复
热议问题