Skip to main content

Regex with structural pattern matching

Project description

pregex

Usage

from pregex import *
pattern = Pattern(["The code is:", Kleene([Require(Raw("[0-9]+"), name="code", post=int), Optional(",")])])
message = "The code is: 123456, 3456"
res = match_rawstring(pattern, message, RegexFlag.SPLIT)
res.group("code")

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

pregex-0.3.2.tar.gz (5.0 kB view hashes)

Uploaded source

Built Distribution

pregex-0.3.2-py3-none-any.whl (5.1 kB view hashes)

Uploaded py3

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 NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page