Skip to main content

Search the regex that fits all querying strings.

Project description

PyPI version PyPI pyversions PyPI license

Search the regex that fits all querying strings.

  • Dozens of pre-written regexes are indexed and organized as a partial order, available in regexorder/templates.json.

  • The regex of all the querying string's least upper bound in the partial order is returned.

  • templates.svg plots the partial order.

Templates

The core part is the pre-written regexes and their respective structure. Currently they only cover the most common cases.

  • Any idea or contribution is highly welcome.

Our regexes utilize some advanced Unicode features, that are not available in standard re library yet. Thus, the more advanced regex library must be used to match our regexes.

Installation

This package is available on PyPI. Just use pip3 install -U RegexOrder to install it.

Examples

from regexorder import RegexOrder

r = RegexOrder()

t = r.match("123")
t.name
# 'positive_integer'
t.regex
# '\\+?\\d+'

t = r.matchall(["apple", "banana", "cheese cake"])
t.name
# 'multiple_lowercase_words'
t.regex
# '\\p{Ll}+(\\s+\\p{Ll}+)*'

Project details


Download files

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

Files for RegexOrder, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size RegexOrder-0.1.tar.gz (3.4 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page