Skip to main content

OORE (Object oriented regular expressions) is a python library that attempts to provide an object oriented layer above the re standard library.

The idea behind this project is to enable users to create and combine regular expressions programmatically. The re module which is a more or less simple wrapper over an underlying C library doesn’t provide any interface that truly makes this possible, which means that especially complex regular expressions need to be generated by concatenating strings.

This means that dealing with such code is annoying, difficult, and error-prone.

To give you an example, this is how you would create a regular expression that matches a Unicode Language Identifier:

from oore import r

digit = r(u'[0-9]')
alpha = r(u'[A-Za-z')
alphanum = r(u'[0-9A-Za-z]')
unicode_variant_subtag = alphanum[5, 8] | (digit + alphanum[3])
unicode_region_subtag = alpha[2] | digit[3]
unicode_script_subtag = alpha[4]
unicode_language_subtag = alpha[2, 8]
sep = r(u'[-_]')

unicode_language_id = r(u'root') | (
    unicode_language_subtag +
    (sep + unicode_script_subtag)[0, 1] +
    (sep + unicode_region_subtag)[0, 1] +
    (sep + unicode_variant_subtag)[0, ...]
)

This can now be used like a re.RegexObject, to get a re.MatchObject you simply use the .match() method:

match = unicode_language_id.match('de-DE')

Metadata

Release files for oore 0.2.1

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

Source distribution (sdist)

Source distribution for oore 0.2.1
File Size Uploaded
oore-0.2.1.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for oore 0.2.1
File Interpreter ABI Platform
oore-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 7.7 kB

Release files / oore-0.2.1.tar.gz

Download URL oore-0.2.1.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9d19c13f10edf0f1889bc0a1cbdef45e29f97dd60594e012e058776242f8c160
BLAKE2b-256 checksum
How to use checksums
7ebf7a71d20df36ae0f697c0f9ddbee6e55b8af8338422598b28b15193ee4091
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / oore-0.2.1-py2.py3-none-any.whl

Download URL oore-0.2.1-py2.py3-none-any.whl
Size 4.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
35f8b0da083f30ce53037c6b9eb6857b724dd904b745d14a2e48a8555c73934d
BLAKE2b-256 checksum
How to use checksums
b3c5717358e6cc8ec4168cbae1fb36c5656ed19958da3cb8c19e2eaaf04fb4cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

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