Skip to content

re2.Match object is not subscriptable #31

@JustAnotherArchivist

Description

@JustAnotherArchivist

Since Python 3.6, the re.Match object has a __getitem__ method which simply passes through to .group() and allows for accessing groups by subscripting: https://docs.python.org/3/library/re.html#re.Match.__getitem__

re2.Match currently does not support this:

>>> import re2
>>> m = re2.match('.', 'abc')
>>> m[0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 're2.Match' object is not subscriptable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions