Simpler, cleaner access to regular expressions. Globs too.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simplere-1.2.13.zip.
File metadata
- Download URL: simplere-1.2.13.zip
- Upload date:
- Size: 20.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6c9d3f2dcdbc2deb144e870c183ab948edf2862b1c933a4e9228eb34b261d5f
|
|
| MD5 |
f6a3227638776aaec20513c2262bef0e
|
|
| BLAKE2b-256 |
130661dfe9a30a3b450b76ee4ef9dfc13a473f0858114489bdc4611f269989a7
|
File details
Details for the file simplere-1.2.13-py2.py3-none-any.whl.
File metadata
- Download URL: simplere-1.2.13-py2.py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20ecb195771385183112451ccf31a85361fed64b0f516461751748efb011635d
|
|
| MD5 |
f0dd3e050c21a852283e8b34c56dee8f
|
|
| BLAKE2b-256 |
2d4b06feffa34dffc859c690e7a27733f54c85fdaa07b665dd3b7aded77843b4
|