
Python 3.4 supports only 100 regex groups - MosheZada
https://github.com/python/cpython/blob/3.4/Lib/sre_compile.py#L577
======
namtrac
I guess you meant Python _3.4_ because 3.5 has no limitation:
[https://github.com/python/cpython/blob/3.5/Lib/sre_compile.p...](https://github.com/python/cpython/blob/3.5/Lib/sre_compile.py)

~~~
jepler
yeah it took me a bit to figure it out but "lt" in the original post text is
supposed to mean "less than" or "older than"..

~~~
raldi
I thought it said "Python it"

~~~
agumonkey
I was betting on a python lite implementation for embedded boards.

------
orf
Some might say if you need 100+ regex groups you have other problems...

~~~
harryf
If you're using regular expressions for lexing anything moderately complex,
e.g a wiki markup, you could easily find yourself needing 100+ groups,
especially if you're generating the expressions from some kind of input
grammar

~~~
justin_vanw
If you are lexing there is a much better way than trying to munge together a
giant regex manually:

[https://github.com/python/cpython/blob/3.4/Lib/re.py#L346](https://github.com/python/cpython/blob/3.4/Lib/re.py#L346)

~~~
DasIch
No, using a completely undocumented class that heavily relies on further
undocumented parts of the standard library that might be implementation
details of the regex implementation is much better.

~~~
justin_vanw
It's been there for like 10 years, I think you'll be ok if you use it... If it
goes away, you can just bring it back right?

~~~
DasIch
It'll stay but it's still undocumented and the code heavily relies on things
that are undocumented as well. This makes understanding it unnecessarily
difficult and forces you to comment your own code quite extensively.

On the other hand you can easily generate a regular expression by doing a
little bit of trivial string manipulation everyone is going to understand.

~~~
justin_vanw
So take the 'undocumented' code, copy it, paste it into a file, put the
license comment at the top, and move on with your life. String munging regexes
together is going to be slower and error prone.

------
0x0
[https://github.com/python/cpython/commit/33455fe85760e0173ee...](https://github.com/python/cpython/commit/33455fe85760e0173eeecef52c76de4240e10663#diff-5812393a306237111d8f76f73783e386)

~~~
joshmaker
> raise error("groups number is too large")

Oh, I hate that kind of error message. Why couldn't it be something useful
like

    
    
        raise error("groups number is too large "
                    "(you have used %d out of an "
                    "allowed %d)" % (self.groups, MAXGROUPS))

~~~
brianwawok
It has a todo. Possibly just s fast hack till you can come back and fix it...
Then fast hack became release :)

------
agumonkey
I'd like to see someone type a regex with 100 capturing groups.

~~~
rgacote
I'd like to see someone _debug_ a regex with 100 capturing groups.

~~~
jepler
Such expressions are likely to be generated. In fact, the Python issue refers
to a lexer for javascript. Imagine your design is to have one capturing group
for each different language keyword, and suddenly it doesn't seem so silly any
longer.
[https://bugs.python.org/issue22437](https://bugs.python.org/issue22437)

------
lucb1e
Cpython, right? Not python the language,if I understand this correctly.

------
rnhmjoj
Yeah, like GHC supporting only up to 62-tuple. Very limiting.

