Accept empty patterns at startWith and endWith. Correct escaping before specials translation.