improved regex mapping