| 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 |