add a regex syntax check and test it