skip to navigation
skip to content

inrex 1.1.1

Regular expressions as infix operations

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+'
 
File Type Py Version Uploaded on Size # downloads
inrex-1.1.1.tar.gz (md5) Source 2010-03-29 2KB 461
  • Author: Krister Hedfors
  • Maintainer: Krister Hedfors
  • Keywords: regexp regular expressions infix operations operators
  • License: Free software
  • Categories
  • Package Index Owner: fleskfleskarn
  • DOAP record: inrex-1.1.1.xml