🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

magicregex

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magicregex

Readable regular expressions in Python

0.1.3
PyPI
Maintainers
1

🦄 Magic RegEx

Readable Regular Expressions for Python

Stable Version Python Versions License Downloads

  • Runtime is ultra-minimal
  • Compiles to pure RegEx
  • Automatically typed capture groups
  • 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

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts