Is there a simple way to remove positive/negative lookbehind/lookahead groups from a regex expression using another regex expression (taking inside parenthesis into account)?
The example source expression: A(?<!B(C)D)E(?<=F)G(?!H(I(J))K)L(?=M(O)P)Q(?>R)S(T)
The parts I want removed:
(?<!B(C)D)(?<=F)(?!H(I(J))K)(?=M(O)P)
So far, I made the expression \(\?\<?[!=].+?\) to find the parts to remove but the inside parenthesis creates problems... For example, instead of finding the part (?<!B(C)D), it finds (?<!B(C)...
I thought about replacing the (?<!, (?!, (?<= & (?= with (?# (transforming them into embedded comment) and that works perfectly on "regex101.com" but sadly not in JAVA...
I'm trying to avoid having to loop through every chars with a bunch of if-else logic.
Note: I'm using these regex expression in Java (Kotlin) and using "containsMatchIn" method to match the source expression to actual text.