I have this regex code in python:
if re.search(r"\{\\fad|fade\(\d{1,4},\d{1,4}\)\}", text):
print(re.search(r"\{\\fad|fade\((\d{1,4}),(\d{1,4})\)\}", text).groups())
textis {\fad(200,200)}Épisode 101 : {\i1}The Ghost{\i0}\Nv. 1.03and is read from a file (I do not know if this helps).
This returns the following:
(None, None)
When I change the regular expression in print to r"\{\\fad\((\d{1,4}),(\d{1,4})\)\}", it returns the correct values:
(200, 200)
Can anyone understand why the conditional fad|fadematches the regular expression in re.searchbut does not return the correct group values in print?
Thanks.
source
share