This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: [proposal] alternative for re.sub
Type: enhancement Stage:
Components: Regular Expressions Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: ocean-city, timehorse
Priority: normal Keywords:

Created on 2008-07-02 08:43 by ocean-city, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg69087 - (view) Author: Hirokazu Yamamoto (ocean-city) * (Python committer) Date: 2008-07-02 08:43
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.
msg73981 - (view) Author: Jeffrey C. Jacobs (timehorse) Date: 2008-09-28 18:11
Implementing Issue 3482 should solve this problem, and I will try to add 
it to issue 2636 so that it is captured in the general Regexp 2.7 
redesign.
History
Date User Action Args
2022-04-11 14:56:36adminsetgithub: 47505
2008-10-03 19:55:46ocean-citysetstatus: open -> closed
resolution: duplicate
2008-09-28 18:11:21timehorsesetnosy: + timehorse
messages: + msg73981
versions: + Python 2.7
2008-07-02 08:43:11ocean-citycreate