[英]How to replace specific strings between two strings in php
我想從此模板生成sql:
select * from event where
status_id = 'TOREPLACE_1'
or status_id = 'TOREPLACE_2'
....
得到這個結果:
select * from event where
status_id = (select id from name = 'TOREPLACE_1' limit 1)
or status_id = (select id from name = 'TOREPLACE_2' limit 1)
.....
問題是如何在每個status_id =之后選擇''之間的表達式
謝謝
使用以下正則表達式:
/status_id\s*=\s*\'([^\']+)\'/
整個解決方案將需要這樣的東西:
preg_match_all($regexp, $string, $matches);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.