[lang-ref] ( regexp_replace_all ) ( python )

def test_regexp_replace_all():
    # re.sub()

    text = 'abcdefgh abcdefgh abcdefgh'
    pattern = r'd.f'
    after   = 'DEF'

    r = re.sub(pattern, after, text)

    assert r == 'abcDEFgh abcDEFgh abcDEFgh'