Q:

How to replace specific strings between two strings in php

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

A:

Use the following regexp:
/status_id\s*=\s*\'([^\']+)\'/

The whole solution would require something like that: 
preg_match_all($regexp, $string, $matches); 

