samedi 11 mai 2019

Python auto-detect and split regex groups

I have a regex pattern which is too long to type it here, but you can read it from here:

https://linksnappy.com/api/REGEX

I want to re.compile it straight away, but I am getting AssertionError and inability to compile more than 100 named groups.

I tried writing a regex pattern to split the regex pattern, but it's way too difficult to make it work and not raise any exceptions from sre_*.py.

Is there a function which can automatically split capture groups, similar to sre_parse, but make a list with the regex alternatives from the above pattern?

Aucun commentaire:

Enregistrer un commentaire