Look-behind requires fixed-width pattern issue
I have a regex
(?<=--my-service(\s|\t)*=(\s|\t)*")(.*?)(?=("\s\\\n)|("(\s|\t)*>>(\s|\t)*\/dev\/null(\s|\t)*2>&1))
and this regexp works at least on https://www.freeformatter.com/regex-tester.html
with test data
--my-service="test-service" >> /dev/null 2>&1
it matches
--my-service="test-service" >> /dev/null 2>&1
However, when I try to run this very same regex with python it gives me
look-behind requires fixed-width pattern
Is there any way to translate this regex to python?
Solution 1:
So, what I did was I segregated chunks of regex to groups and then did something like this
\1\2my text\4\5