Only escape regex when begin capture exists