Skip to content

[proposal] alternative for re.sub #47505

Closed

Description

@ocean-city
mannequin
BPO 3255

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 = None
closed_at = <Date 2008-10-03.19:55:46.392>
created_at = <Date 2008-07-02.08:43:11.253>
labels = ['expert-regex', 'type-feature']
title = '[proposal] alternative for re.sub'
updated_at = <Date 2008-10-03.19:55:46.391>
user = 'https://bugs.python.org/ocean-city'

bugs.python.org fields:

activity = <Date 2008-10-03.19:55:46.391>
actor = 'ocean-city'
assignee = 'none'
closed = True
closed_date = <Date 2008-10-03.19:55:46.392>
closer = 'ocean-city'
components = ['Regular Expressions']
creation = <Date 2008-07-02.08:43:11.253>
creator = 'ocean-city'
dependencies = []
files = []
hgrepos = []
issue_num = 3255
keywords = []
message_count = 2.0
messages = ['69087', '73981']
nosy_count = 2.0
nosy_names = ['ocean-city', 'timehorse']
pr_nums = []
priority = 'normal'
resolution = 'duplicate'
stage = None
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue3255'
versions = ['Python 2.7']

Activity

  1. ocean-city commented on Jul 2, 2008

    ocean-citymannequin
    MannequinAuthor

    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.

  2. timehorse commented on Sep 28, 2008

    timehorsemannequin
    Mannequin

    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.

  3. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions