Skip to main content

Python bindings for Ogex regex engine with unified syntax

Project description

Ogex Python Bindings

Python bindings for the Ogex regex engine with unified syntax support.

Installation

pip install ogex

Usage

import ogex

# Basic matching
regex = ogex.Regex(r"hello (\w+)")
match = regex.search("hello world")
if match:
    print(match.text)  # "hello world"
    print(match.group(1))  # "world"

# Named groups with unified syntax
regex = ogex.Regex(r"(name:\w+) is \g{name}")
match = regex.search("John is John")
if match:
    print(match.text)  # "John is John"
    print(match.named_group("name"))  # "John"

# Relative backreferences
regex = ogex.Regex(r"(a)(b)\g{-1}")
print(regex.is_match("abb"))  # True

# Replacements
result = ogex.sub(r"(name:\w+)", r"[\g{name}]", "hello name:world")
print(result)  # "hello [world]"

# Find all matches
regex = ogex.Regex(r"\w+")
matches = regex.findall("hello world")
print([m.text for m in matches])  # ["hello", "world"]

API

Regex(pattern)

Compile a regex pattern.

regex.search(string)

Search for the first match.

regex.match_(string)

Match at the start of the string.

regex.is_match(string)

Check if pattern matches.

regex.findall(string)

Find all matches.

regex.sub(repl, string, count=None)

Replace matches.

License

MPL-2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ogex-0.1.1-cp314-cp314-manylinux_2_34_x86_64.whl (309.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

File details

Details for the file ogex-0.1.1-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ogex-0.1.1-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3aaa450438d5e63e86e1f2241b90239ed82428e029eb7f8768a43f439d0a340b
MD5 229f755b061cf37b6022c3511c6c6c98
BLAKE2b-256 2545023370026afa692c0d4a6cb81aa39155496375c7dd13f63440536177b1c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ogex-0.1.1-cp314-cp314-manylinux_2_34_x86_64.whl:

Publisher: release.yml on NiXTheDev/Ogex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page