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.3.tar.gz
(3.1 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.3.tar.gz.
File metadata
- Download URL: lrparse-0.1.3.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c57e65d0268927001fd28a1f934026f27e462fe2defcdbd5f2508c5321f02eb
|
|
| MD5 |
0285a9566cdee3beb2b3917310fd8f40
|
|
| BLAKE2b-256 |
3a745e3f1f4259e4d925f3ca97b8af2e1ddde13a7646cf2ccf0db1ca9b51cf3f
|
File details
Details for the file lrparse-0.1.3-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: lrparse-0.1.3-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 9.7 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 |
dce6b358113d94a907f19001b56baefe31bec6729b3a6184c13c426c210b2773
|
|
| MD5 |
e69ada909e04284d647ad9d44d2a96e3
|
|
| BLAKE2b-256 |
6c67449196f09a0a89278c33bbae624081a0eb700a118f5b0d73c12e6f4cc363
|