Skip to main content

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+'

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 inrex, version 1.1.1
Filename, size File type Python version Upload date Hashes
Filename, size inrex-1.1.1.tar.gz (2.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page