error checking for regex