Skip to main content

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


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.4.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lrparse-0.1.4-cp313-cp313-win_amd64.whl (9.6 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file lrparse-0.1.4.tar.gz.

File metadata

  • Download URL: lrparse-0.1.4.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

Hashes for lrparse-0.1.4.tar.gz
Algorithm Hash digest
SHA256 daa44f622247dbf52e1f5edee1caef3f348fab16e0906ae63132206599d9f10e
MD5 fbd88f94a2a4d081c2d3da8bf445f424
BLAKE2b-256 7577f11cd6381dbaff98c2911c4bf2e94a4396b51be60df586a44e7a75e2594e

See more details on using hashes here.

File details

Details for the file lrparse-0.1.4-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: lrparse-0.1.4-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 9.6 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

Hashes for lrparse-0.1.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f1a63a91890e32e4f82c855c76ab25b689c2118b7a316836c49a930f736beb29
MD5 e6de654725a0073d85db5d9d0d2bbef6
BLAKE2b-256 8ee5cc6a61d8d861799a8c8c3505225775742888847907f3f5971eb138f34b5a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page