Skip to main content

🦄 Magic RegEx

Readable Regular Expressions for Python

Stable Version Python Versions License Downloads

  1. Runtime is ultra-minimal
  2. Compiles to pure RegEx
  3. Automatically typed capture groups
  4. Natural language syntax

This library is a port of the magic-regexp JavaScript module by Daniel Roe.

Quickstart

First, install magicregex by

pip install magicregex

Second, find e-mails in text by

import magicregex as mre

reg = mre.createRegEx(
    mre.exactly(
        mre.letter.TimesAtLeast(1)
        .And(mre.exactly('@'))
        .And(mre.letter.TimesAtLeast(1))
        .And(mre.exactly('.'))
        .And(mre.letter.TimesAtLeast(2))
    )
)
reg.findall('daniel@roe.uk lore ipsum thomas@wollmann.de') 
# Result: ['daniel@roe.uk', 'thomas@wollmann.de']

Documentation

Up to now, this module is compatible with magic-regexp's documentation.

Contribute

Made with ❤️. If you want to support:

  • Clone this repository
  • Install dependencies using poetry install --with dev
  • Run tests using pytest
  • Run code checks using pre-commit run

Metadata

Release files for magicregex 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for magicregex 0.1.3
File Size Uploaded
magicregex-0.1.3.tar.gz 8.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for magicregex 0.1.3
File Interpreter ABI Platform
magicregex-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / magicregex-0.1.3.tar.gz

Download URL magicregex-0.1.3.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
67237639953721d955d0edd934eeb61adfa5f2ab2424a7b4ab0ce4a00d85dcf5
BLAKE2b-256 checksum
How to use checksums
89e20b17c4df344297664a3f39f1922731a2d5832ab95bd900e2089f1f04052f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Linux/5.15.0-1033-azure

Release files / magicregex-0.1.3-py3-none-any.whl

Download URL magicregex-0.1.3-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a1ddc11f5599809262de7bc707584cae630509619b25103cb16ec03c8106332
BLAKE2b-256 checksum
How to use checksums
2f6e1c7078cb274542838939714228d76c48a742009dd223e346bc5913ce6b09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.0 CPython/3.10.10 Linux/5.15.0-1033-azure

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page