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 2008-10-03 19:55 by ocean-city. 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
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