Skip to main content

Simpler, cleaner access to regular expressions. Globs too.

Project description

Travis CI build status PyPI Package latest release PyPI Package monthly downloads Supported versions Supported implementations Wheel packaging support Test line coverage Test branch coverage

A simplified interface to Python’s regular expression (re) string search. Eliminates steps and provides simpler access to results. As a bonus, also provides compatible way to access Unix glob searches.

Usage

Python regular expressions are powerful, but the language’s lack of an en passant (in passing) assignment requires a preparatory motion and then a test:

import re

match = re.search(pattern, some_string)
if match:
    print match.group(1)

With simplere, you can do it in fewer steps:

from simplere import *

if match / re.search(pattern, some_string):
    print match[1]

That’s particularly valuable in complex search-and-manipulate code that requires multiple levels of searching along with pre-conditions, error checking, and post-match cleanup, formatting, and actions.

As a bonus, simplere also provides simple glob access.:

if 'globtastic' in Glob('glob*'):
    print "Yes! It is!"
else:
    raise ValueError('OH YES IT IS!')

It can also conveniently match against multiple glob patterns, and/or do case-insensitive glob searches.

See Read the Docs for the full installation and usage documentation.

Project details


Download files

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

Source Distribution

simplere-1.2.11.zip (20.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simplere-1.2.11-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2Python 3

File details

Details for the file simplere-1.2.11.zip.

File metadata

  • Download URL: simplere-1.2.11.zip
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for simplere-1.2.11.zip
Algorithm Hash digest
SHA256 06a36c9fdb4f01f3fdc99cf1d4f6e31f2f524c6b2653f73ea2b41f52e404b483
MD5 673db0d33226e89a605dccc30121e2ee
BLAKE2b-256 7f901338114273dc2c2663aa78550440b86651d552ce2b2aee38ae150b9b8ac8

See more details on using hashes here.

File details

Details for the file simplere-1.2.11-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for simplere-1.2.11-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1f31be6e54d71dd31fba96ae0bd80d3b5042fe9b4645fe61506315a38357b554
MD5 0a2c19eef0c725d139f25651e182ed41
BLAKE2b-256 95d9b891723ebb164047c1eab6265d83fe46077d28cdbb833dbfa9225d3fa184

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page