public List < String > getTextGroups ( final String toTest , final int group ) { List < String > groups = new ArrayList <> ( ) ; Matcher m = pattern . matcher ( toTest ) ; while ( m . find ( ) ) { groups . add ( m . group ( group ) ) ; } return groups ; }
Extract exact group from string and add it to list