MCPcopy Create free account
hub / github.com/google/re2j / findSubmatch

Method findSubmatch

java/com/google/re2j/RE2.java:716–728  ·  view source on GitHub ↗
(String s)

Source from the content-addressed store, hash-verified

714 */
715 // This is visible for testing.
716 String[] findSubmatch(String s) {
717 int[] a = doExecute(MachineInput.fromUTF16(s), 0, UNANCHORED, prog.numCap);
718 if (a == null) {
719 return null;
720 }
721 String[] ret = new String[1 + numSubexp];
722 for (int i = 0; i < ret.length; i++) {
723 if (2 * i < a.length && a[2 * i] >= 0) {
724 ret[i] = s.substring(a[2 * i], a[2 * i + 1]);
725 }
726 }
727 return ret;
728 }
729
730 /**
731 * Returns an array holding the index pairs identifying the leftmost match of this regular

Callers 1

testFindSubmatchMethod · 0.80

Calls 3

doExecuteMethod · 0.95
fromUTF16Method · 0.95
substringMethod · 0.80

Tested by 1

testFindSubmatchMethod · 0.64