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
Most obvious thing to do would be using compile method in java.util.regex.Pattern and catch PatternSyntaxException
PatternSyntaxException
String myRegEx; ... ... Pattern p = Pattern.compile(myRegEx);
This will throw a PatternSyntaxException if myRegEx is invalid.