Skip to main content

Non-String Regular Expressions

Build Status

NSRE (Non-String Regular Expressions) is a new spin at regular expressions. It's really abstract, even compared to regular expressions as you know them, but it's also pretty powerful for some uses.

Here's the twist: what if regular expressions could, instead of matching just character strings, match any sequence of anything?

from nsre import *

re = RegExp.from_ast(seq('hello, ') + (seq('foo') | seq('bar')))
assert re.match('hello, foo')

The main goal here is matching NLU grammars when there is several possible interpretations of a single word, however there is a lot of other things that you could do. You just need to understand what NSRE is and apply it to something.

Note — This is inspired by this article from Russ Cox, which explains how Thompson NFA work, except that I needed to add some features and then the implementation is much less elegant because I actually don't know what I'm doing. But it seems to be working.

Documentation

✨ Documentation is there ✨

Licence

This library is provided under the terms of the WTFPL.

If you find it useful, you can have a look at the contributors page to know who helped.

Metadata

Release files for nsre 0.2.0

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

Source distribution (sdist)

Source distribution for nsre 0.2.0
File Size Uploaded Provenance
nsre-0.2.0.tar.gz 13.0 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 26.6 kB

Release files / nsre-0.2.0.tar.gz

Download URL nsre-0.2.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
4a1e749c75f190fbc8f32a67394a554117a97f625a32cde5704e187cb2edefab
BLAKE2b-256 checksum
How to use checksums
8c826b0bb758b8a463b88e02e98fa43ed57f647e3e88d66fcc0d6dcbe6b39558
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.6.8 Linux/4.15.0-76-lowlatency

Release files / nsre-0.2.0-py3-none-any.whl

Download URL nsre-0.2.0-py3-none-any.whl
Size 13.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0082e91537c9f095a0eea11160b64d3cb7828332d50d0b926362d63d241dd04d
BLAKE2b-256 checksum
How to use checksums
3dcabccac5168f94ab4bc58c99158b339d715070e50c9d82e881915b2b3025f4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.3 CPython/3.6.8 Linux/4.15.0-76-lowlatency

Security for nsre 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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