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.
- Host: GitHub
- URL: https://github.com/aaravmalani/regexbuilder
- Owner: AaravMalani
- License: mit
- Created: 2023-09-29T06:43:36.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-29T06:46:34.000Z (about 2 years ago)
- Last Synced: 2025-02-15T17:46:39.063Z (8 months ago)
- Topics: python, python3, re, regex, regexp, wrapper
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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]+((?:.))
```