| 678 | */ |
| 679 | // This is visible for testing. |
| 680 | byte[][] findUTF8Submatch(byte[] b) { |
| 681 | int[] a = doExecute(MachineInput.fromUTF8(b), 0, UNANCHORED, prog.numCap); |
| 682 | if (a == null) { |
| 683 | return null; |
| 684 | } |
| 685 | byte[][] ret = new byte[1 + numSubexp][]; |
| 686 | for (int i = 0; i < ret.length; i++) { |
| 687 | if (2 * i < a.length && a[2 * i] >= 0) { |
| 688 | ret[i] = Utils.subarray(b, a[2 * i], a[2 * i + 1]); |
| 689 | } |
| 690 | } |
| 691 | return ret; |
| 692 | } |
| 693 | |
| 694 | /** |
| 695 | * Returns an array holding the index pairs identifying the leftmost match of this regular |