OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --harmony-regexp-lookbehind | 5 // Flags: --harmony-regexp-lookbehind |
6 | 6 |
7 // Simple fixed-length matches. | 7 // Simple fixed-length matches. |
8 assertEquals(["a"], "a".match(/^.(?<=a)/)); | 8 assertEquals(["a"], "a".match(/^.(?<=a)/)); |
9 assertNull("b".match(/^.(?<=a)/)); | 9 assertNull("b".match(/^.(?<=a)/)); |
10 assertEquals(["foo"], "foo1".match(/^f..(?<=.oo)/)); | 10 assertEquals(["foo"], "foo1".match(/^f..(?<=.oo)/)); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 assertEquals(["fno"], "fno".match(/^f.o(?<!foo)$/)); | 150 assertEquals(["fno"], "fno".match(/^f.o(?<!foo)$/)); |
151 assertEquals(["foooo"], "foooo".match(/^foooo(?<=fo+)$/)); | 151 assertEquals(["foooo"], "foooo".match(/^foooo(?<=fo+)$/)); |
152 assertEquals(["foooo"], "foooo".match(/^foooo(?<=fo*)$/)); | 152 assertEquals(["foooo"], "foooo".match(/^foooo(?<=fo*)$/)); |
153 assertEquals(["abc", "abc"], /(abc\1)/.exec("abc")); | 153 assertEquals(["abc", "abc"], /(abc\1)/.exec("abc")); |
154 assertEquals(["abc", "abc"], /(abc\1)/.exec("abc\u1234")); | 154 assertEquals(["abc", "abc"], /(abc\1)/.exec("abc\u1234")); |
155 assertEquals(["abc", "abc"], /(abc\1)/i.exec("abc")); | 155 assertEquals(["abc", "abc"], /(abc\1)/i.exec("abc")); |
156 assertEquals(["abc", "abc"], /(abc\1)/i.exec("abc\u1234")); | 156 assertEquals(["abc", "abc"], /(abc\1)/i.exec("abc\u1234")); |
157 var oob_subject = "abcdefghijklmnabcdefghijklmn".substr(14); | 157 var oob_subject = "abcdefghijklmnabcdefghijklmn".substr(14); |
158 assertNull(oob_subject.match(/(?=(abcdefghijklmn))(?<=\1)a/i)); | 158 assertNull(oob_subject.match(/(?=(abcdefghijklmn))(?<=\1)a/i)); |
159 assertNull(oob_subject.match(/(?=(abcdefghijklmn))(?<=\1)a/)); | 159 assertNull(oob_subject.match(/(?=(abcdefghijklmn))(?<=\1)a/)); |
| 160 |
| 161 // Mutual recursive capture/back references |
| 162 assertEquals(["cacb", "a", ""], /(?<=a(.\2)b(\1)).{4}/.exec("aabcacbc")); |
| 163 assertEquals(["b", "ac", "ac"], /(?<=a(\2)b(..\1))b/.exec("aacbacb")); |
| 164 assertEquals(["x", "aa"], /(?<=(?:\1b)(aa))./.exec("aabaax")); |
| 165 assertEquals(["x", "aa"], /(?<=(?:\1|b)(aa))./.exec("aaaax")); |
OLD | NEW |