我想从这个模板生成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 =
之后选择''之间的表达式由于
答案 0 :(得分:3)
使用以下正则表达式:
/status_id\s*=\s*\'([^\']+)\'/
整个解决方案需要类似的东西:
preg_match_all($regexp, $string, $matches);