Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SRE: Atomic Grouping (?>...) is not supported #34627

Closed
effbot mannequin opened this issue Jun 14, 2001 · 14 comments
Closed

SRE: Atomic Grouping (?>...) is not supported #34627

effbot mannequin opened this issue Jun 14, 2001 · 14 comments
Labels
3.11 only security fixes stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement

Comments

@effbot
Copy link
Mannequin

effbot mannequin commented Jun 14, 2001

BPO 433030
Nosy @birkenfeld, @terryjreedy, @ezio-melotti, @serhiy-storchaka
PRs
  • bpo-433030: Add support of atomic grouping in regular expressions #31982
  • Files
  • issue2636-01.patch
  • re_atomic_groups.patch
  • 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 = None
    created_at = <Date 2001-06-14.08:30:56.000>
    labels = ['expert-regex', 'type-feature', 'library', '3.11']
    title = 'SRE: Atomic Grouping (?>...) is not supported'
    updated_at = <Date 2022-03-21.16:28:37.831>
    user = 'https://bugs.python.org/effbot'

    bugs.python.org fields:

    activity = <Date 2022-03-21.16:28:37.831>
    actor = 'serhiy.storchaka'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)', 'Regular Expressions']
    creation = <Date 2001-06-14.08:30:56.000>
    creator = 'effbot'
    dependencies = []
    files = ['10646', '37182']
    hgrepos = []
    issue_num = 433030
    keywords = ['patch']
    message_count = 12.0
    messages = ['53164', '63284', '63288', '64634', '64735', '65777', '68337', '113201', '114621', '231041', '231049', '415685']
    nosy_count = 10.0
    nosy_names = ['effbot', 'georg.brandl', 'terry.reedy', 'rsc', 'timehorse', 'ezio.melotti', 'mrabarnett', 'THRlWiTi', 'abacabadabacaba', 'serhiy.storchaka']
    pr_nums = ['31982']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue433030'
    versions = ['Python 3.11']

    @effbot
    Copy link
    Mannequin Author

    effbot mannequin commented Jun 14, 2001

    from the jeffrey friedl report:

    (?>...) is not supported

    [this is a "stand-alone pattern". the engine has code
    for this, but the parser doesn't recognize this yet.
    shouldn't be too hard to fix; I just need a couple of
    good test cases before I start /F]

    @effbot effbot mannequin self-assigned this Jun 14, 2001
    @effbot effbot mannequin added topic-regex type-feature A feature request or enhancement labels Jun 14, 2001
    @effbot effbot mannequin self-assigned this Jun 14, 2001
    @effbot effbot mannequin added topic-regex type-feature A feature request or enhancement labels Jun 14, 2001
    @akuchling
    Copy link
    Member

    Also referred to as an atomic group: see
    http://www.regular-expressions.info/atomic.html for a discussion.

    Fredrik, when you say "the engine has code for this", what do you mean?

    @akuchling
    Copy link
    Member

    There's also an alternate syntax for this, called possessive
    quantifiers: a*+, a++, a{m,n}+.

    @timehorse
    Copy link
    Mannequin

    timehorse mannequin commented Mar 28, 2008

    Fredrik,

    If you're still listening, I am gonna try and tackle this one but I
    would like to know why you or the famous Jeffrey of the Regexp world
    claims that there is already code in the Regexp Engine for Atomic
    Grouping? Adding a hook for (?>...) should be trivial but I don't wanna
    re-invent the wheel if the proper stack-unwind code already exists.
    Thanks. Of course, Andrew (a.k.a. A.M. Kuchling) already asked this
    question and you did not answer it, so I guess you're not reading this,
    but if you are, please respond. Thanks!

    @timehorse timehorse mannequin changed the title SRE: (?>...) is not supported SRE: Atomic Grouping (?>...) is not supported Mar 28, 2008
    @timehorse timehorse mannequin changed the title SRE: (?>...) is not supported SRE: Atomic Grouping (?>...) is not supported Mar 28, 2008
    @timehorse
    Copy link
    Mannequin

    timehorse mannequin commented Mar 29, 2008

    I'm digging into the sre_parse.py at the moment and this I have all the
    changes I need for that now. The rest of the changes I believe are in
    either sre_compile.py or more likely directly in _sre.c, so I will
    examine those files next. I am attaching a single diff for
    expedience. This is not an official patch, just a sample to see the
    progress I am making. I forgot the correct format for patch files but
    I promise to get it right when I have made more progress.

    @timehorse timehorse mannequin added stdlib Python modules in the Lib dir labels Mar 29, 2008
    @timehorse
    Copy link
    Mannequin

    timehorse mannequin commented Apr 25, 2008

    Quick update (see thread 2636 for other updates to the Regex
    functionality): I do have a design in my mind for how to accomplish both
    Atomic Grouping and Possessive Qualifiers and it would work with either
    the existing Engine design or the new design I have been playing with.
    It's just a matter of getting around to implementing it, testing it and
    documenting it.

    I currently am having problem with Bazaar / Launchpad which are beyond
    the scope of this issue but are effecting my work. Those issues can be
    found on the Launchpad site if you look for Answers / Bugs originating
    from "timehorse".

    @timehorse
    Copy link
    Mannequin

    timehorse mannequin commented Jun 17, 2008

    I have finished work on the Atomic Grouping / Possessive Qualifiers
    support and am including a patch to achieve this; however,
    http://bugs.python.org/issue2636 should be consulted for the complete list
    of changes in the works for the Regexp engine.

    @terryjreedy
    Copy link
    Member

    Does the re2 work (bpo-2636) make this outdated?

    @birkenfeld
    Copy link
    Member

    Implemented in bpo-2636.

    @serhiy-storchaka
    Copy link
    Member

    Some unrelated to the topic changes from the patch are committed in 30a6c74ad87f.

    @serhiy-storchaka
    Copy link
    Member

    Reopened because definitely regex will be not adopted in 3.5.

    Here is updated to 3.5 Jeffrey's patch.

    @AlexWaygood AlexWaygood added 3.11 only security fixes labels Mar 19, 2022
    @serhiy-storchaka
    Copy link
    Member

    New changeset 345b390 by Serhiy Storchaka in branch 'main':
    bpo-433030: Add support of atomic grouping in regular expressions (GH-31982)
    345b390

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
    @hugovk
    Copy link
    Member

    hugovk commented Apr 11, 2022

    Closing because GH-31982 has been merged.

    @gpshead
    Copy link
    Member

    gpshead commented Jul 26, 2023

    This feature addition led to #106052

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes stdlib Python modules in the Lib dir topic-regex type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    7 participants