skillfed

stringparser

Easy to use pattern matching and information extraction

stringparser v0.7 193.2K downloads/30d#9,852 on PyPI42
Permissive license BSD-3-Clause DORMANT released

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 stringparser

uv

uv add stringparser

poetry

poetry add stringparser

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Text Processing

Tags

string pattern matching without regexextract values from formatted stringsPEP 3101 format string parsingsimple string parsing libraryformat string pattern extraction
string-parsingformat-stringsdata-extraction

More Libraries packages