Commit 94e21dea authored by Joshua Litt's avatar Joshua Litt Committed by Commit Bot

[regexp] Add additional test for match indices.

Bug: v8:9548
Change-Id: I0842ca8ce49ea3a831ae4f168c6dfa7d65dfe063
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1930173Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Joshua Litt <joshualitt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65156}
parent aff30817
...@@ -135,3 +135,12 @@ ...@@ -135,3 +135,12 @@
} }
assertTrue(rec()); assertTrue(rec());
} }
// Match between matches.
{
const re = /a+(?<A>zz)?(?<B>ii)?/;
const m = re.exec("xaaazzii");
assertTrue(/b+(?<C>cccc)?/.test("llllllbbbbbbcccc"));
assertEquals(m.indices, [[1, 8], [4, 6], [6, 8]]);
assertEquals(m.indices.groups, {'A': [4, 6], 'B': [6, 8]});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment