0

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

1 Answer 1

3

Use the following regexp:

/status_id\s*=\s*\'([^\']+)\'/

The whole solution would require something like that:

preg_match_all($regexp, $string, $matches); 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.