No project description provided
Project description
# Regular expressions made readable
## Introduction
bourbaki.regex provides an interface for constructing arbitrarily complex regular expressions using standard Python syntax.
The goals of the package are the following:
allow the user to be as terse as possible while not sacrificing readability
support the full range of constructs available in the standard library regex engine (re module)
be extensible and modular to support more advanced constructs in the future, as for instance provided by the regex module
handle minutiae such as handling backreferences (inferring the correct group index)
raise meaningful errors at compile time, such as named group collisions, nonexistent backreferences, and lookbehind assertions that are not fixed-length.
## Usage
There are a few base constructors from which all expression patterns can be built:
bourbaki.regex.C: Character class constructor. C[‘a’:’z’, ‘A-Z’, ‘0’:’9’] for instance is equivalent to the raw regular expression r’[a-zA-Z0-9]
bourbaki.regex.L/Literal: Literal string match. This handles escaping special characters that are reserved for regular expression syntax. For example L(‘*foo[bar]*’) is equivalent to the raw regular expression r’*foo[bar]*’ (note the ‘' escapes)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for bourbaki.regex-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a1387596591b53ca8ac275ca95e627558d7a28ad9f20a5abe72355cf553e7c8 |
|
MD5 | b9e1d3463c3272a3bcad600fefce81dd |
|
BLAKE2b-256 | 3ed6a308e30b0d7d7ea09ee004d635ee130e4e50097e199248ba610f6c94fc7c |