You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sub function would not work without the flags but the search would work fine #85930
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-09-11.18:10:33.855>created_at=<Date2020-09-11.17:12:58.342>labels= ['expert-regex', 'invalid', '3.8']
title='sub function would not work without the flags but the search would work fine'updated_at=<Date2020-09-11.18:10:33.854>user='https://bugs.python.org/bayat'
it would work like this sub("pattern","replace", txt, flags= re.IGNORECASE | re.DOTALL)
but it wouldnt work like this sub("pattern","replace", txt, re.IGNORECASE | re.DOTALL)
Activity
bayat commentedon Sep 11, 2020
it would work like this sub("pattern","replace", txt, flags= re.IGNORECASE | re.DOTALL)
but it wouldnt work like this sub("pattern","replace", txt, re.IGNORECASE | re.DOTALL)
mrabarnett commentedon Sep 11, 2020
The arguments are: re.sub(pattern, repl, string, count=0, flags=0).
Therefore:
is passing re.IGNORECASE | re.DOTALL as the count, not the flags.
It's in the documentation and the interactive help.