Skip to main content

Class wrappers for regular expressions with proper fields for match groups.

Project description

For the time being, more documentation is at this project’s github pages.

rewrapped lets you write your regular expressions as classes with match groups flexibly mapped to named fields.

A simple example:

from rewrapped import ReWrap, matched
class Inventory(ReWrap):
    matchOn = "([0-9]+)\s+(\S+)"
    count = matched.g1.asInt
    item = matched.g2

This will yield match results which map the first match field to the integer count, and the second to the string field item:

>>> i ="there are 45 oranges left")
>>> i.count
>>> i.item

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for rewrapped, version 0.4.2
Filename, size File type Python version Upload date Hashes
Filename, size rewrapped-0.4.2.tar.gz (19.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page