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

Method findAllSubmatch

java/com/google/re2j/RE2.java:917–938  ·  view source on GitHub ↗
(final String s, int n)

Source from the content-addressed store, hash-verified

915 */
916 // This is visible for testing.
917 List<String[]> findAllSubmatch(final String s, int n) {
918 final List<String[]> result = new ArrayList<String[]>();
919 allMatches(
920 MachineInput.fromUTF16(s),
921 n,
922 new DeliverFunc() {
923 @Override
924 public void deliver(int[] match) {
925 String[] slice = new String[match.length / 2];
926 for (int j = 0; j < slice.length; ++j) {
927 if (match[2 * j] >= 0) {
928 slice[j] = s.substring(match[2 * j], match[2 * j + 1]);
929 }
930 }
931 result.add(slice);
932 }
933 });
934 if (result.isEmpty()) {
935 return null;
936 }
937 return result;
938 }
939
940 /**
941 * {@code findAllSubmatchIndex} is the <a href='#all'>All</a> version of

Callers 2

testFindAllSubmatchMethod · 0.80

Calls 3

allMatchesMethod · 0.95
fromUTF16Method · 0.95
isEmptyMethod · 0.80

Tested by 2

testFindAllSubmatchMethod · 0.64