Closed JustAnotherArchivist closed 3 years ago
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__
re.Match
__getitem__
.group()
re2.Match currently does not support this:
re2.Match
>>> 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
Thanks for letting me know. Pull requests welcome!
Any idea when this is going to be released ? I am trying to switch to re2 for security concerns and would love to not have to refactor my codebase 🙏🏻
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: