Regular expressions as infix operations
Project description
from inrex import match, search, split, findall, finditer
if 'asd 123' |match| r'(\w+) (\d+)':
print 'word is', match[0]
print 'digit is', match[1]
if 'asd 123' |match| r'(?P<word>\w+) (?P<digit>\d+)':
print 'word is', match['word']
print 'digit is', match['digit']
print 'asd 123 qwe 456' |findall| r'\d+'
print 'asd 123 qwe 456' |split| r'\d+'
print 'asd 123 qwe 456' |split(maxsplit=1)| r'\d+'
if 'asd 123' |match| r'(\w+) (\d+)':
print 'word is', match[0]
print 'digit is', match[1]
if 'asd 123' |match| r'(?P<word>\w+) (?P<digit>\d+)':
print 'word is', match['word']
print 'digit is', match['digit']
print 'asd 123 qwe 456' |findall| r'\d+'
print 'asd 123 qwe 456' |split| r'\d+'
print 'asd 123 qwe 456' |split(maxsplit=1)| r'\d+'
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
inrex-1.1.1.tar.gz
(2.7 kB
view details)
File details
Details for the file inrex-1.1.1.tar.gz
.
File metadata
- Download URL: inrex-1.1.1.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2f955ee175b7103d8162f89a89dcfff6213c5d90b10ada25c93ab3b6de1838b |
|
MD5 | 04bae262e8ef6b5c6ef97cd29900db66 |
|
BLAKE2b-256 | 0ee31208aaa54f622ca637b090ac5d64459f6a37ad0fa46fa78f0f5785922848 |