I probably didn't phrase the question in the best way, but bear with me
Having this string
select * from my_functions (in_p1 := remove,
in_p2 := $1,
in_p3 := remove,
in_p4 := $2,
in_p5 := remove,
in_p6 := $3,
in_p7 := remove)
I need to remove the parameters that are matched for retrieval, with the remove keyword
So I built this text = text.replace(/,[^,]*?remove/g, ''), which works for every case except p1. How can I tell it to stop the match immediattly or if there's a comma, to only stop after the comma ?