question: @ SuppressWarnings ( "regex" ) public static PatternSyntaxException regexException ( String s , int groups ) { try { Pattern p = Pattern . compile ( s ) ; int actualGroups = getGroupCount ( p ) ; if ( actualGroups < groups ) { return new PatternSyntaxException ( regexErrorMessage ( s , groups , actualGroups ) , s , - 1 ) ; } } catch ( PatternSyntaxException pse ) { return pse ; } return null ; }
target:  Returns null if the argument is a syntactically valid regular expression with at least the given number of groups. Otherwise returns a PatternSyntaxException describing why the argument is not a regex.