public List < String [ ] > getAllMatches ( String string ) { Matcher matcher = pattern . matcher ( string ) ; List < String [ ] > matched = new ArrayList < String [ ] > ( ) ; while ( matcher . find ( ) ) { int count = matcher . groupCount ( ) ; String [ ] strings = new String [ count ] ; for ( int i = 0 ; i < count ; ++ i ) { strings [ i ] = matcher . group ( i + 1 ) ; } matched . add ( strings ) ; } return matched ; }
Retrieves a list of tokens in the input string that match this regular expression .