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.6.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.6.tar.gz.
File metadata
- Download URL: lrparse-0.1.6.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 |
a7f4679216efdc6bc6cf19f5fb2d96857f3f2a048b0fd434352acae7dddc072d
|
|
| MD5 |
ae0bf498ab0ec50265af273981655d97
|
|
| BLAKE2b-256 |
543e623442da28777fbba93e5b0cbeb5017017ecb9aa4b0828307d0c40c78ae7
|
File details
Details for the file lrparse-0.1.6-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: lrparse-0.1.6-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 |
fabfb753cb020af06dbccffe238fc9940b292848b414ba1f5cb91eaa19d3034e
|
|
| MD5 |
0d2f4aaf1227032afe24ae07920ecb67
|
|
| BLAKE2b-256 |
a286ad99c6145a54c6529a1ea0290ed62970918ebd239237f78543f5e5a2996f
|