Revert "catch whether the regex is valid or not before we perform any operations"

This reverts commit 9db8ca146e2c292829836e69939c6f870953ed86.