Skip to main content

Alternative regular expression module, to replace re.

Project description

regex_hir

A high-level intermediate representation of regex in Python.

PyPi | Github Source

Installation

Requires Python >=3.10. Also requires the unicategories library for easy access to categorised Unicode characters.

Description

This library constructs an intermediate representation of the regex AST created by the built-in re module. This functions similary to the Rust regex_syntax crate, which was completely the inspiration for this module.
All of the syntax supported by re is supported by this module.

Usage

import regex_hir

hir = regex_hir.hir(r"[abc]")
hir.dumps()
# CharacterClass(
#     [
#         CharacterRange(start=97, end=97)
#         CharacterRange(start=98, end=98)
#         CharacterRange(start=99, end=99)
#     ]
#     negate=False
#     ignore_case=False
# )

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

regex_hir-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

File details

Details for the file regex_hir-0.1.1.tar.gz.

File metadata

  • Download URL: regex_hir-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.0b3

File hashes

Hashes for regex_hir-0.1.1.tar.gz
Algorithm Hash digest
SHA256 26859fc1eaedf18b6279cdf4abcb9b0e4093a17ee60db56fd90be6eadb66f8d3
MD5 e40f166cc23103fff6faed114e1b6160
BLAKE2b-256 85c54626902b914723c5b77e6fbb5540a469f2b4466f8e69b18842c166705123

See more details on using hashes here.

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