'Test regex matching and replacing.'

def test_match_replace_regex(self):

    regex = re.compile('\\Adb_([^.]*).foo\\Z')
    self.assertIsNone(match_replace_regex(regex, 'db.foo', '*.foo'))
    self.assertIsNone(match_replace_regex(regex, 'db.foo.foo', '*.foo'))
    self.assertEqual(match_replace_regex(regex, 'db_bar.foo', '*.foo'), 'bar.foo')
