Skip to main content
https://travis-ci.org/hansi-b/rewrapped.svg?branch=master https://codecov.io/gh/hansi-b/rewrapped/branch/master/graph/badge.svg https://badge.fury.io/py/rewrapped.svg

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

rewrapped lets you wrap your regular expressions in 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 = Inventory.search("there are 45 oranges left")
>>> i.count
45
>>> i.item
'oranges'
>>>

Download files

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

Source Distribution

rewrapped-0.5.0.tar.gz (20.5 kB view details)

Uploaded Source

File details

Details for the file rewrapped-0.5.0.tar.gz.

File metadata

  • Download URL: rewrapped-0.5.0.tar.gz
  • Upload date:
  • Size: 20.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rewrapped-0.5.0.tar.gz
Algorithm Hash digest
SHA256 ba70a42c4e14b2728a4c507b070089edcc48acb733ec42cc4b19a4ef73c887a4
MD5 a19dec6335e630affac4a91139274058
BLAKE2b-256 79a9cb8fd8f910396aa2fb35cd3f2aab932245a057f3179584f3d5d16d4d8aed

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.5.0 This release

1 file

0.4.2

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page