I want to match the following pattern using python's re.search:
((not open bracket, then 1-3 spaces) or (the start of the string)) then (characters 1 or E) then (any number of spaces) then (close bracket).
Here is what I have so far:
re.search(r'((^\(\s{1,3})|^)[1tE]\s+\)', text)
want to match examples
text = " E )"
text = "1 )"
Dont want to match example
text = "( 1 )
\(that matches it, why? Tryre.search(r'^(?:[^(]\s{1,3})?[1tE]\s+\)', text), see demo.% E )