Given following Java expression codes:
boolean match = row.matches("('.*')?,('.*')?"); if the match is true, it means the regex matches whole 'row'. Then I could I get the content of the two groups? Each one is ('.*')?
To access the groups you need to use Matcher: Pattern.compile(regex).matcher(row).
Then you can call find() or matches() on the matcher to execute the matcher and if they return true you can access the groups via group(1) and group(2).
String row = "'what','ever'"; Matcher matcher = Pattern.compile("('.*')?,('.*')?").matcher( row ); if( matcher.matches() ) { String group1 = matcher.group( 1 ); String group2 = matcher.group( 2 ); }