I am trying to match a pattern with the string, below is the code
bool(re.match('.._.. abc_xycompanies_........_._zip(001)','23_61 abc_xycompanies_20201212_1_zip(001)'))
The above code returns False, but if i change it to below then it is returning True. Dont know why but value inside the zip() is not getting matched.
bool(re.match('.._.. abc_xycompanies_........_._zip()','23_61 abc_xycompanies_20201212_1_zip()'))
How can i resolve this issue.
Parentheses have special meaning in regex, so you need to escape them in your case, to indicate you mean the specific parentheses symbols. Note:
P.S. Both your examples didn't match by me, so you might have some other issue as well.