MCPcopy Index your code
hub / github.com/processing/processing / matchAll

Method matchAll

core/src/processing/core/PApplet.java:9360–9380  ·  view source on GitHub ↗

( begin auto-generated from matchAll.xml ) This function is used to apply a regular expression to a piece of text, and return a list of matching groups (elements found inside parentheses) as a two-dimensional String array. No matches will return null. If no groups are specified in the regexp, but t

(String str, String regexp)

Source from the content-addressed store, hash-verified

9358 * @see PApplet#trim(String)
9359 */
9360 static public String[][] matchAll(String str, String regexp) {
9361 Pattern p = matchPattern(regexp);
9362 Matcher m = p.matcher(str);
9363 List<String[]> results = new ArrayList<>();
9364 int count = m.groupCount() + 1;
9365 while (m.find()) {
9366 String[] groups = new String[count];
9367 for (int i = 0; i < count; i++) {
9368 groups[i] = m.group(i);
9369 }
9370 results.add(groups);
9371 }
9372 if (results.isEmpty()) {
9373 return null;
9374 }
9375 String[][] matches = new String[results.size()][count];
9376 for (int i = 0; i < matches.length; i++) {
9377 matches[i] = results.get(i);
9378 }
9379 return matches;
9380 }
9381
9382
9383

Callers

nothing calls this directly

Calls 5

matchPatternMethod · 0.95
findMethod · 0.80
getMethod · 0.65
addMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected