[英]How to make php match regex NOT matching over lines?
我的代码是
preg_replace("/([^; ]+)=>([^; ]+)/", "ec_set('$1',$2);", $input_lines);
在匹配以下文本时
test=>1; test; test=>123;
asdf
test=>[[test]]
结果
正在输出超线
ec_set('test',1);; test; ec_set('test',123);; ec_set('
asdf
test',[[test]]);
怎么做
ec_set('test',1);; test; ec_set('test',123);;
asdf
ec_set('test',[[test]]);
?
尝试这个:
preg_replace("/([^;\\n ]+)=>([^;\\n ]+)/", "ec_set('$1',$2);", $input_lines);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.