stringparser
Easy to use pattern matching and information extraction
What it is and what it does
stringparser provides a lightweight alternative to regular expressions for extracting structured data from strings. Instead of writing regex patterns, you write format strings using the familiar PEP 3101 syntax (the same format used by Python's str.format() method). The Parser class matches a string against a pattern and returns extracted values as scalars, lists, OrderedDicts, or nested objects depending on how you name and structure the fields.
The library is intentionally simpler than regex—it matches from beginning to end and supports only a subset of format string features (type specifiers, sign, and the # flag). This makes it ideal for parsing structured text with known layouts, such as log lines, configuration values, or simple tabular data, where regex would be overkill but string splitting is too fragile.
Use it for:
- Parse log lines with a known format to extract timestamps, levels, or message content.
- Extract key-value pairs from structured text without writing regex patterns.
- Build reusable parsers for configuration files or data exports with consistent formatting.
- Extract and map fields into object attributes for lightweight data binding.
- Parse simple tabular or columnar text where format is predictable.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Extracts values from strings using format-string patterns instead of regular expressions, supporting simple field extraction, ordering, and nested object assignment.
Yes, if you need lightweight pattern matching on structured text and want to avoid regex complexity. The low install friction, permissive license, and stable API make it a reasonable choice for parsing tasks with known, simple formats. However, the dormant maintenance status means you should verify that the feature set covers your use case before committing to it, and be prepared to maintain a fork if critical issues arise.
Install
stringparser on PyPI
pip
pip install stringparseruv
uv add stringparserpoetry
poetry add stringparserInstalling stringparser
Before you install
Low friction: pure Python wheel with a single runtime dependency (typing-extensions). Dormant maintenance status since last commit 2023-11-16, but no recent activity suggests stability rather than active development.
License in practice
BSD-3-Clause permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
from stringparser import Parser
parser = Parser('The answer is {:d}')
result = parser('The answer is 42')
print(result) # Output: 42
Requires Python 3.9 or later.
Verify before relying
- Whether dormant maintenance status indicates ongoing stability or de facto abandonment risk.
- Performance characteristics compared to regex for large-scale parsing tasks.
- Whether all format string spec features needed for your use case are implemented (only type, sign, and # are currently supported).
Package facts
| License | BSD-3-Clause (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | dormant — 1,002 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 193,248/month — #9,852 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: stringparser-0.7-py3-none-any.whl
Keywords: string, parsing, PEP3101, regex
Tags
More Libraries packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
python-dateutilProvides parsing, arithmetic, and recurrence…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
pygrokParses strings and extracts structured data…
permissive · top 15,000 on PyPI
nr-dateA pure-Python date parser using regex patterns…
permissive · top 15,000 on PyPI
flake8-pep3101A flake8 plugin that detects and flags…
copyleft · top 15,000 on PyPI
exrexExrex generates all or random strings matching…
agpl · top 15,000 on PyPI
repathConverts Express-style path strings (like…
permissive · top 15,000 on PyPI
commonregexExtracts dates, times, emails, phone numbers,…
permissive · top 15,000 on PyPI
ttpTTP is a Python library for parsing…
permissive · top 15,000 on PyPI
ripgrepyRipgrepy is a Python wrapper around the ripgrep…
unclear · top 15,000 on PyPI
objprintobjprint provides functions to print Python…
permissive · top 5,000 on PyPI
FixedWidthConverts between Python dictionaries and…
permissive · top 5,000 on PyPI