我有弦乐像这样:preg_replace函数更改文本开始“@”和结束“@ n”
@
String mystr = "[email protected]"
String mystr = [email protected]@@@::example.com;
@
我首先要改变“@”到[代码]和secont最后'@'到[/ code]。
在第一个和最后一个'@'之后,我们有空格或'\ n'。
这个代码不为我工作:
$text = preg_replace('#[@](.|)(.*?)[@\n]#',"'<pre>$2</pre>'",$text);
非常goo.thanks.but如果我有超过1代码的字符串,它合并他们在一起! – user1829014
@ user1829014我已更新我的答案。如果我理解正确,第二部分涵盖你说的话。 – sierrasdetandil
太棒了。很感谢 – user1829014