Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)
Regular expression replacement. Target is either compiled re object or
string that will be compiled into one. Replacement is either string or
function that takes re match object as a parameter and returns replacement
string. Intead of Python's stock ``_sre.SRE_Match`` objects, returns a
``ReMatch``, which adds the ability to directly access via indices

src/s/a/say-1.2.3/test/test_textrange.py   say(Download)
    assert tr.lines == 'a b'.split()
 
    tr.re_replace(r'[b]', 'B')
    tr.re_replace(r'a', lambda m: m.group(0).upper())
    assert t.lines == 'a a A B a'.split()