question: @ SuppressWarnings ( "purity" ) private static boolean isRegex ( String s ) { try { Pattern . compile ( s ) ; } catch ( PatternSyntaxException e ) { return false ; } return true ; }
target:  This method is a copy of RegexUtil.isRegex. We cannot directly use RegexUtil, because it uses type annotations which cannot be used in IDEs (yet).