I have a little program allowing users to type-in some regular expressions. afterwards I like to check if this input is a valid regex or not.
I\'m w
new String().matches(regEx) can be directly be used with try-catch to identify if regEx is valid.
boolean isValidRegEx = true; try { new String().matches(regEx); } catch(PatternSyntaxException e) { isValidRegEx = false; }