Skip to main content

Simpler, cleaner access to regular expressions. Globs too.

Project description

Travis CI build status PyPI Package latest release 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.

Files for simplere, version 1.2.13
Filename, size File type Python version Upload date Hashes
Filename, size simplere-1.2.13-py2.py3-none-any.whl (6.8 kB) File type Wheel Python version 3.6 Upload date Hashes View
Filename, size simplere-1.2.13.zip (20.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