Skip to main content

Simpler, cleaner access to regular expressions. Globs too.

Project description

https://travis-ci.org/jonathaneunice/simplere.png?branch=master https://pypip.in/d/simplere/badge.png

A simplified interface to Python’s regular expression (re) string search that tries to eliminate steps and provide 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!')

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

Project details


Release history Release notifications

History Node

1.2.13

History Node

1.2.11

History Node

1.2.9

History Node

1.2.8

History Node

1.2.7

History Node

1.2.6

History Node

1.2.5

History Node

1.2.0

History Node

1.1.1

History Node

1.1.0

History Node

1.0.10

History Node

1.0.9

History Node

1.0.8

History Node

1.0.7

This version
History Node

1.0.5

History Node

1.0.3

History Node

1.0.2

History Node

1.0

Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
simplere-1.0.5.tar.gz (6.0 kB) Copy SHA256 hash SHA256 Source None Sep 13, 2013
simplere-1.0.5.zip (10.1 kB) Copy SHA256 hash SHA256 Source None Sep 13, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page