➜

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
标题: [proposal] alternative for re.sub
类型: enhancement Stage:
Components: Regular Expressions Versions: Python 2.7
process
状态: closed Resolution: duplicate
Dependencies: 后续:
分配给: 抄送列表: ocean-city, timehorse
优先级: normal 关键字:

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) 日期: 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) 日期: 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.
历史
日期 用户 动作 参数
2022-04-11 14:56:36admin修改github: 47505
2008-10-03 19:55:46ocean-city修改状态: open -> closed
resolution: duplicate
2008-09-28 18:11:21timehorse修改抄送: + timehorse
消息: + msg73981
versions: + Python 2.7
2008-07-02 08:43:11ocean-city创建