Mateusz Ravage Mateusz Ravage - 1 year ago 41
PHP Question

Regular expression - match strings between range

I have a string which looks like this:

UPDATE id = :id, password = :password;

I want to match this string:

id = :id, password = :password

I wrote this regexp:


but it matches only

id = :id,

I tried also this regexp:


but it cannot recognize a range what I want to match

How I have to define range in the right way to match that what I want?

I will be grateful for any advice.

Answer Source

If input string is always a similar UPDATE statement:


Live demo