public static int preg_match ( Pattern pattern , String subject ) { int matches = 0 ; Matcher m = pattern . matcher ( subject ) ; while ( m . find ( ) ) { ++ matches ; } return matches ; }
Matches a string with a pattern .