regex – How to write in one regexp two regexps where the second one cleans the leftover from the first one?
I have this case as example, where I need to transform the left side to the right side (filtering out everything with KO):
item n1: KO, diff item 2: OK, item number3: OK, subitem 4: KO -> diff item 2: OK, item number3: OK
with a potential varying number of itemX.
At the moment I am applying 2 regexps to get to the right side:
s/[a-z0-9\s]*:\sKO,?\s?//gwhich takes to -> diff item 2: OK, item number3: OK,
and finally s/,?\s?$// to remove the final , .
Is there a way to have only one regexp instead of 2?
Read more here: Source link
