Skip to content

Toilal/rebulk

Repository files navigation

ReBulk

Latest Version MIT License Build Status Codecov semantic-release

ReBulk is a python library that performs advanced searches in strings that would be hard to implement using re or string methods only.

It provides Patterns, Match, Rule and a fluent API to build a custom and complex string matcher that stays readable and extendable.

Install

$ pip install rebulk

Usage

String, regular expression and function based patterns are declared on a Rebulk object, then matches returns every Match found in the input string.

>>> from rebulk import Rebulk
>>> bulk = Rebulk().string('brown').regex(r'qu\w+').functional(lambda s: (20, 25))
>>> bulk.matches("The quick brown fox jumps over the lazy dog")
[<brown:(10, 15)>, <quick:(4, 9)>, <jumps:(20, 25)>]

From there you can name and tag matches, validate and format their values, compose patterns into chains, and register rules that inspect and rewrite the match set. See the documentation for the full API and advanced patterns.

Documentation

Full documentation is available at toilal.github.io/rebulk. A preview of the in-development develop branch is published at toilal.github.io/rebulk/dev.

Support

This project is hosted on GitHub. Feel free to open an issue if you think you have found a bug or something is missing.

License

ReBulk is licensed under the MIT license.

About

Define simple search patterns in bulk to perform advanced matching on any string

Resources

License

Stars

59 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors

Languages