Skip to main content

Python 3.6 sre_parse module

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Python 3.6 sre_parse module

Why

The initial motivation to "create" sre_parse36 is to provide a colorizer for regular expressions that produce the same expression as initially provided.

The handling of non-capturing groups changed from Python 3.7, we can't back reproduce the original regular expression from a SubPattern instance anymore. This regression is tracked at https://bugs.python.org/issue45674, hopefully it will be fixed in a future Python 3.9 bugfix release.

In Python 3.6:

>>> import sre_parse
>>> sre_parse.parse("(?:foo (?:bar) | (?:baz))").dump()
SUBPATTERN None 0 0
  BRANCH
    LITERAL 102
    LITERAL 111
    LITERAL 111
    LITERAL 32
    SUBPATTERN None 0 0
      LITERAL 98
      LITERAL 97
      LITERAL 114
    LITERAL 32
  OR
    LITERAL 32
    SUBPATTERN None 0 0
      LITERAL 98
      LITERAL 97
      LITERAL 122

In Python 3.7 and beyond:

>>> import sre_parse
>>> sre_parse.parse("(?:foo (?:bar) | (?:baz))").dump()
BRANCH
  LITERAL 102
  LITERAL 111
  LITERAL 111
  LITERAL 32
  LITERAL 98
  LITERAL 97
  LITERAL 114
  LITERAL 32
OR
  LITERAL 32
  LITERAL 98
  LITERAL 97
  LITERAL 122

Install

pip install sre_parse36

Usage

Replace sre_parse by sre_parse36.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sre_parse36-1.0.0.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sre_parse36-1.0.0-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

Details for the file sre_parse36-1.0.0.tar.gz.

File metadata

  • Download URL: sre_parse36-1.0.0.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.10

File hashes

Hashes for sre_parse36-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3304ad42c03373278fa51b1cb51c6eb9e7749a0d9faa570ce09522fc84ae9618
MD5 81ae32b40d9ed19ce3696b506428f2b9
BLAKE2b-256 ad9be93f249c94811504f8a105f2cc23bb35c11c2fe6fb0d816fa8944fb6720f

See more details on using hashes here.

File details

Details for the file sre_parse36-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sre_parse36-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 21.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.10

File hashes

Hashes for sre_parse36-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb1379ac5d7ab0bcb4e8444a5b42ea5514e648731f4d30967c0729266d9d32ed
MD5 09058551840eff3a47379cd34f984084
BLAKE2b-256 92f9793311ff3306fa459ed93fa423983489975f5d157951d31af58a61a85078

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page