Build and explain Python Regex patterns in a human-friendly way
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file regexplain-0.1.0a11.tar.gz.
File metadata
- Download URL: regexplain-0.1.0a11.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.3 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44c0197889c7f305f339afd835ed389c66ad7c9284e15a9281d15e8e170db157
|
|
| MD5 |
30c1d521602a91844441eefdec36bbea
|
|
| BLAKE2b-256 |
1316e3834235b78e6894d4be4bce0b954dcda4c90789cd408aaf04bf1d2e9d87
|
File details
Details for the file regexplain-0.1.0a11-py3-none-any.whl.
File metadata
- Download URL: regexplain-0.1.0a11-py3-none-any.whl
- Upload date:
- Size: 25.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: pdm/2.22.3 CPython/3.13.2 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
855070bebf9ad9442f4a91141c4aa62ed5d8a417399f96a9a18cb237e5b70fa6
|
|
| MD5 |
accfea39bebb023b898f41091d8a2227
|
|
| BLAKE2b-256 |
114f55f1844c12faeaf5b3774034eacc919cf274bbea8b271427f2cea9d28dc7
|