santinic / pampy

Pampy: The Pattern Matching for Python you always dreamed of.
MIT License
3.52k stars 125 forks source link

Support regex library #30

Open Mdslino opened 5 years ago

Mdslino commented 5 years ago

Today I tried to write the following recursive regex {(?:[^{}]|(?R))*} to find a json inside a string, but the std library re do not support this, then I install regex. But in pampy typing validation the pattern instance is checked against stdlib re.

elif isinstance(pattern, RegexPattern):
    rematch = pattern.search(value)
    if rematch is not None:
        return True, list(rematch.groups())

Is possible to support a external library or will it against the project goal? If its possivel I can open a PR for this.