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
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=<Date2008-10-03.19:55:46.392>created_at=<Date2008-07-02.08:43:11.253>labels= ['expert-regex', 'type-feature']
title='[proposal] alternative for re.sub'updated_at=<Date2008-10-03.19:55:46.391>user='https://bugs.python.org/ocean-city'
I often do same mistake again and again. Most of re module's method
takes optional argument "flags" like this.
finditer( pattern, string[, flags])
But, sub() takes optional argument "count" not "flags".
sub( pattern, repl, string[, count])
So, when I write this code, it doesn't behave like what I want.
re.sub("<[^>]+>", "", content, re.S)
I think it would be nice if the method which takes optional argument
"flags" and do same behavior with re.compile(pattern[, flags]).sub(repl,
string). Thank you.
Activity
ocean-city commentedon Jul 2, 2008
I often do same mistake again and again. Most of re module's method
takes optional argument "flags" like this.
But, sub() takes optional argument "count" not "flags".
So, when I write this code, it doesn't behave like what I want.
I think it would be nice if the method which takes optional argument
"flags" and do same behavior with re.compile(pattern[, flags]).sub(repl,
string). Thank you.
timehorse commentedon Sep 28, 2008
Implementing bpo-3482 should solve this problem, and I will try to add
it to bpo-2636 so that it is captured in the general Regexp 2.7
redesign.