An open API service indexing awesome lists of open source software.

https://github.com/aaravmalani/regexbuilder

A functional wrapper for RegEx in Python.
https://github.com/aaravmalani/regexbuilder

python python3 re regex regexp wrapper

Last synced: 6 months ago
JSON representation

A functional wrapper for RegEx in Python.

Awesome Lists containing this project

README

          

# RegexBuilder: A functional wrapper for RegEx in Python.

## Installation
```sh
python -m pip install regexbuilder-py
# or
python -m pip install git+https://github.com/AaravMalani/regexbuilder
```

## Usage
```py
print(RegEx().start() \
.string('http') \
.chars('s').modify(Modifiers.ZERO_OR_ONE) \
.string('://') \
.group(RegEx()
.chars('a-zA-Z0-9') \
.modify(Modifiers.ONE_OR_MORE) \
.chars(r'.')) \
.modify(Modifiers.ZERO_OR_MORE) \
.chars('A-Za-z0-9').modify(Modifiers.ONE_OR_MORE) \
.chars('.') \
.chars('A-Za-z').modify(Modifiers.ONE_OR_MORE) \
.group(RegEx().string('.')).build())
# $(?:http)[s]?(?:://)([a-zA-Z0-9]+[.])*[A-Za-z0-9]+[.][A-Za-z]+((?:.))
```