I would like to generate sql from this template :
select * from event where
status_id = 'TOREPLACE_1'
or status_id = 'TOREPLACE_2'
....
to have this result :
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)
.....
the question is how to select the expression between '' after every status_id =
Thanks
Use the following regexp:
/status_id\s*=\s*\'([^\']+)\'/
The whole solution would require something like that:
preg_match_all($regexp, $string, $matches);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.