我的代码是
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]]);
?
([^;'s]+)=>([^;'s]+)
试试这个。请参阅演示。
https://regex101.com/r/vH0iN5/4
试试这个:
preg_replace("/([^;'n ]+)=>([^;'n ]+)/", "ec_set('$1',$2);", $input_lines);