Left/right substring extraction
Project description
lrparse
lrparse is a tiny, fast Python library written in C for extracting substrings between left and right delimiters.
It provides two functions:
lr()– returns the first substring between delimiters.lrr()– returns all substrings between delimiters.
Installation
pip install lrparse
Usage
import lrparse
# lr() → first match between delimiters
print(lrparse.lr("pre[mid]post", "[", "]"))
# ['mid']
# lrr() → all matches between delimiters
print(lrparse.lrr("<a><b>c", "<", ">"))
# ['a', 'b']
# If delimiters don't exist, you get an empty list
print(lrparse.lr("hello world", "{", "}"))
# []
# If both delimiters are empty, the whole string is returned
print(lrparse.lr("abc", "", ""))
# ['abc']
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
lrparse-0.1.7.tar.gz
(3.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lrparse-0.1.7.tar.gz.
File metadata
- Download URL: lrparse-0.1.7.tar.gz
- Upload date:
- Size: 3.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c05f67af486b6609e4406bc56b557812e9830e99276e5ee16ccaad339d49bc0
|
|
| MD5 |
3bf754ab7c022a1d55c8be0dcd66e48b
|
|
| BLAKE2b-256 |
315af624f42ade5fe71a543d900f2092026c87e99b785adeba329f1f09c55014
|
File details
Details for the file lrparse-0.1.7-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: lrparse-0.1.7-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 9.9 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7609a7eee2fc83fecdf15e14036a1e066113b085cae40ec212a4c08b279d3c74
|
|
| MD5 |
56c18d63016820c849faa941557674d2
|
|
| BLAKE2b-256 |
0713bd3544b88a2de4b527789a6bcd93b84c7f290c774a3f755549de1eec627b
|