Issue 3255: [proposal] alternative for re.sub (original) (raw)

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.