This function is used to apply a regular expression to a piece of text, and return matching groups (elements found inside parentheses) as a String array. If there are no matches, a null value will be returned. If no groups are specified in the regular expression, but the sequence matches, an
(String str, String regexp)
| 8536 | * @see PApplet#trim(String) |
| 8537 | */ |
| 8538 | static public String[] match(String str, String regexp) { |
| 8539 | Pattern p = matchPattern(regexp); |
| 8540 | Matcher m = p.matcher(str); |
| 8541 | if (m.find()) { |
| 8542 | int count = m.groupCount() + 1; |
| 8543 | String[] groups = new String[count]; |
| 8544 | for (int i = 0; i < count; i++) { |
| 8545 | groups[i] = m.group(i); |
| 8546 | } |
| 8547 | return groups; |
| 8548 | } |
| 8549 | return null; |
| 8550 | } |
| 8551 | |
| 8552 | |
| 8553 | /** |
no test coverage detected