Skip to main content

Parser for string sequence, inspired by reguar expressions

Project description

seqpat

seqpat is a Python library designed for flexible and efficient sequence pattern matching, primarily aimed at converting microformats from various command-line tools into JSON format.

The motivation behind this project was the idea: "Wouldn't it be great if we could perform operations on a sequence of strings (i.e., lines of text like in a text file) in the same way we use regular expressions on individual strings (i.e., a sequence of characters)?"

Features

  • Pattern Matching: Match sequences of strings using customizable patterns.
  • Sequence Handling: Process and parse structured text data efficiently.
  • Flexible Parsing: Handle continuation lines, key-value pairs, and more.
  • Customizable Replacements: Use pattern-based substitutions to transform the input as needed.

Installation

You can install seqpat using pip:

pip install seqpat

Patterns/Utility Functions

The core of seqpat is its ability to define and use flexible patterns for text matching. It provides:

  • R: A pattern that matches regular expressions.
  • gsub: A function for global substitution based on patterns.
  • split_by: A function to split a sequence of strings by a delimiter pattern.

For detailed usage, please refer to the Docstrings, and for examples, see the examples directory.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests on the GitHub repository.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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

seqpat-0.1.0.tar.gz (8.9 kB view hashes)

Uploaded Source

Built Distribution

seqpat-0.1.0-py3-none-any.whl (7.8 kB view hashes)

Uploaded Python 3

Supported by

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