Skip to main content

# GoRella [![Build Status](https://travis-ci.org/frostming/gorella.svg?branch=master)](https://travis-ci.org/frostming/gorella)

Monkey patch regular expression methods to built-in string types

## Introduction This project is aiming at easing the use of regular expression, which is inspired by RegExp in JavaScript. The name comes from “gorilla” and “re”. The sing-file module will monkey patch the following built-in methods of string types on its import:

  • replace

  • split and rsplit

  • find and rfind

  • index and rindex

  • partition and rpartition

  • count

  • startswith and endswith

Besides, it extends the built-in string types with following methods of re module:

  • match

  • search

  • findall

  • finditer

## Usage All you need is to import gorella in one line, everything is done for you: `python >>> import gorella >>> 'I am 26 years old.'.search('\d+').group() '26' ` For built-in methods, when pass a regular expression object, it will call the corresponding re function, else it falls back to built-in one: `python >>> pat = re.compile('\d+') >>> 'I am 26 years old.'.find('am') 2 >>> 'I am 26 years old.'.find(pat) 5 >>> 'I am 26 years old.'.partition(pat) ('I am ', '26', ' years old') ` Because it replaces the pure-C methods with python ones, the performance may be affected.

## Python 3 support The monkey patching highly depends on the C-API of CPython, so it doesn’t support other implementations than CPython. The test passes on Python 2.6, 2.7, 3.3, 3.4 and 3.5

## License MIT

Metadata

Release files for gorella 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gorella 0.1.0
File Size Uploaded Provenance Actions
gorella-0.1.0-revision.tar.gz 6.7 kB Without provenance Details for gorella-0.1.0-revision.tar.gz

Release files / gorella-0.1.0-revision.tar.gz

Download URL gorella-0.1.0-revision.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
40bed43c7d30ab5138873775b043440c1c7693afc0a5959225b4c4dee94ad66e
BLAKE2b-256 checksum
How to use checksums
6446965e568037f16c224f05f2e3b88591dfa02fb96633e36beb7f8590b6ed01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for gorella 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

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