Skip to main content

Build and explain Python Regex patterns in a human-friendly way

Project description

PyPI Version PyPI Downloads

Description

Provides Classes to build Python Regex in a more natural way, as well as given an Regex string, deconstruct it and explain in plain English.

This is a development version, and while it has been thoroughly tested, it will be battle-tested in a live project and updated as needed.

from regexplain import RegexTokenizer


reg = RegexTokenizer(r"[^\w\s-]")
reg.explain()

# Explaining Full Pattern: [^\w\s-]
# ┌──
# │   [Span, Length] (0, 8), 8
# │   [Flags] re.NOFLAG
# │  ┌──
# │──│ [^
# │  │   [@0:Character Set] Matches any character not in the set
# │  │   [Span, Length] (0, 8), 8
# │  │   [Flags] re.NOFLAG
# │  │  ┌──
# │  │──│ \w
# │  │  │   [@1:Character Class:Word] Matches any word character (alphanumeric and underscore)
# │  │  │   [Span, Length] (2, 4), 2
# │  │  │   [Flags] re.NOFLAG
# │  │  └──
# │  │  ┌──
# │  │──│ \s
# │  │  │   [@2:Character Class:Whitespace] Matches any whitespace character (space, tab, line-break)
# │  │  │   [Span, Length] (4, 6), 2
# │  │  │   [Flags] re.NOFLAG
# │  │  └──
# │  │  ┌──
# │  │──│ -
# │  │  │   [@3:Literal] Matches a single character from the list '-' (case-sensitive)
# │  │  │   [Span, Length] (6, 7), 1
# │  │  │   [Flags] re.NOFLAG
# │  │  └──
# │  │ ]
# │  │   [@0:End] Token closed
# │  └──
# └──
#

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

regexplain-0.1.0a13.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

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

regexplain-0.1.0a13-py3-none-any.whl (25.9 kB view details)

Uploaded Python 3

File details

Details for the file regexplain-0.1.0a13.tar.gz.

File metadata

  • Download URL: regexplain-0.1.0a13.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.22.3 CPython/3.13.2 Windows/11

File hashes

Hashes for regexplain-0.1.0a13.tar.gz
Algorithm Hash digest
SHA256 898aa7a7fab96ef6a084d60dab916603c8cb8f76c4d39957f482af7c61e5ae58
MD5 84c256dc35f8c224fe81f37b136f8f62
BLAKE2b-256 25d97580a675d5552d0dbb8067c60d2e20d6f2a79cc3c26ce099e95db9c3f328

See more details on using hashes here.

File details

Details for the file regexplain-0.1.0a13-py3-none-any.whl.

File metadata

  • Download URL: regexplain-0.1.0a13-py3-none-any.whl
  • Upload date:
  • Size: 25.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.22.3 CPython/3.13.2 Windows/11

File hashes

Hashes for regexplain-0.1.0a13-py3-none-any.whl
Algorithm Hash digest
SHA256 fbf590ee65959d53b495d18b1325edadb2e674f5392c84646a3d7e7312b7dda7
MD5 3aaba5c21ad9c6e7ccca5687be2c0175
BLAKE2b-256 7ed2c2224d4d7809dcb4e25862782b988a4a6ad1503deb4cd415f991d509c104

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