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.
$ pip install rebulkString, 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.
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.
This project is hosted on GitHub. Feel free to open an issue if you think you have found a bug or something is missing.
ReBulk is licensed under the MIT license.