[英]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.