Is there any way (or possible) to invert match a pattern (not a pre-given word) using regex?
e.g.
Input string:
a:b, c:d, a:b1,s:sad
The pattern is
a:[^,]+,?
This pattern matches "a:b," and "a:b1," in the string. Could I replace/invert match the remain part, i.e. " c:d," and "s:sad" without using grep -v -e?
e.g. continue, demo output replacing the remain with "[TAG]":
a:b,[TAG], a:b1,[TAG]
The [^pattern] or (?!pattern) trick fails and grep with -e -v options are not allowed here.
Thanks!
[^a]:[^,]+,?- pzelaskoa:[^,]+,?(*SKIP)(*F)|(?:(?!a:[^,]+,?).)+. - Wiktor Stribiżew