public String [ ] exec ( String toExec ) { Matcher m = getMatcher ( toExec ) ; if ( m . find ( ) ) { List < String > list = new ArrayList <> ( ) ; int count = m . groupCount ( ) ; For ( 1 ) . to ( count ) . loop ( i -> { list . add ( m . group ( i ) ) ; } ) ; return list . toArray ( new String [ list . size ( ) ] ) ; } else { return null ; } }
same as JavaScript exec