clean up regexp code