fixing regexp compile slowdown