我需要帮助来替换
字符串中的所有\n(新行)字符,而不是[code] [/ code]标记内的那些字符.我的大脑正在燃烧,我无法用自己解决这个问题:(
例:
test test test
test test test
test
test
[code]some
test
code
[/code]
more text
Run Code Online (Sandbox Code Playgroud)
应该:
test test test<br />
test test test<br />
test<br />
test<br />
<br />
[code]some
test
code
[/code]<br />
<br />
more text<br />
Run Code Online (Sandbox Code Playgroud)
谢谢你的时间.最好的祝福.
给定一个正则表达式,我正在寻找一个包,它将动态生成实现RE的有限状态机的代码.
C/C++和Python首选,但其他语言也很受欢迎.