OLD | NEW |
| (Empty) |
1 // Copyright (c) 2014, the Dart project authors. All rights reserved. | |
2 // Copyright 2013 the V8 project authors. All rights reserved. | |
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | |
4 // | |
5 // Redistribution and use in source and binary forms, with or without | |
6 // modification, are permitted provided that the following conditions | |
7 // are met: | |
8 // 1. Redistributions of source code must retain the above copyright | |
9 // notice, this list of conditions and the following disclaimer. | |
10 // 2. Redistributions in binary form must reproduce the above copyright | |
11 // notice, this list of conditions and the following disclaimer in the | |
12 // documentation and/or other materials provided with the distribution. | |
13 // | |
14 // THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | |
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
16 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
17 // DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | |
18 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
19 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
20 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | |
21 // ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
22 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
23 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
24 | |
25 import 'v8_regexp_utils.dart'; | |
26 import 'package:expect/expect.dart'; | |
27 | |
28 void main() { | |
29 description( | |
30 "A chunk of our port of PCRE's test suite, adapted to be more applicable to Ja
vaScript." | |
31 ); | |
32 | |
33 var regex0 = new RegExp(r"a.b"); | |
34 var input0 = "acb"; | |
35 var results = ["acb"]; | |
36 shouldBe(regex0.firstMatch(input0), results); | |
37 var input1 = "a\x7fb"; | |
38 results = ["a\u007fb"]; | |
39 shouldBe(regex0.firstMatch(input1), results); | |
40 var input2 = "a\u0100b"; | |
41 results = ["a\u0100b"]; | |
42 shouldBe(regex0.firstMatch(input2), results); | |
43 // Failers | |
44 var input3 = "a\nb"; | |
45 results = null; | |
46 shouldBe(regex0.firstMatch(input3), results); | |
47 | |
48 var regex1 = new RegExp(r"a(.{3})b"); | |
49 input0 = "a\u4000xyb"; | |
50 results = ["a\u4000xyb", "\u4000xy"]; | |
51 shouldBe(regex1.firstMatch(input0), results); | |
52 input1 = "a\u4000\x7fyb"; | |
53 results = ["a\u4000\u007fyb", "\u4000\u007fy"]; | |
54 shouldBe(regex1.firstMatch(input1), results); | |
55 input2 = "a\u4000\u0100yb"; | |
56 results = ["a\u4000\u0100yb", "\u4000\u0100y"]; | |
57 shouldBe(regex1.firstMatch(input2), results); | |
58 // Failers | |
59 input3 = "a\u4000b"; | |
60 results = null; | |
61 shouldBe(regex1.firstMatch(input3), results); | |
62 var input4 = "ac\ncb"; | |
63 results = null; | |
64 shouldBe(regex1.firstMatch(input4), results); | |
65 | |
66 var regex2 = new RegExp(r"a(.*?)(.)"); | |
67 input0 = "a\xc0\x88b"; | |
68 results = ["a\xc0", "", "\xc0"]; | |
69 shouldBe(regex2.firstMatch(input0), results); | |
70 | |
71 var regex3 = new RegExp(r"a(.*?)(.)"); | |
72 input0 = "a\u0100b"; | |
73 results = ["a\u0100", "", "\u0100"]; | |
74 shouldBe(regex3.firstMatch(input0), results); | |
75 | |
76 var regex4 = new RegExp(r"a(.*)(.)"); | |
77 input0 = "a\xc0\x88b"; | |
78 results = ["a\xc0\x88b", "\xc0\x88", "b"]; | |
79 shouldBe(regex4.firstMatch(input0), results); | |
80 | |
81 var regex5 = new RegExp(r"a(.*)(.)"); | |
82 input0 = "a\u0100b"; | |
83 results = ["a\u0100b", "\u0100", "b"]; | |
84 shouldBe(regex5.firstMatch(input0), results); | |
85 | |
86 var regex6 = new RegExp(r"a(.)(.)"); | |
87 input0 = "a\xc0\x92bcd"; | |
88 results = ["a\xc0\x92", "\xc0", "\x92"]; | |
89 shouldBe(regex6.firstMatch(input0), results); | |
90 | |
91 var regex7 = new RegExp(r"a(.)(.)"); | |
92 input0 = "a\u0240bcd"; | |
93 results = ["a\u0240b", "\u0240", "b"]; | |
94 shouldBe(regex7.firstMatch(input0), results); | |
95 | |
96 var regex8 = new RegExp(r"a(.?)(.)"); | |
97 input0 = "a\xc0\x92bcd"; | |
98 results = ["a\xc0\x92", "\xc0", "\x92"]; | |
99 shouldBe(regex8.firstMatch(input0), results); | |
100 | |
101 var regex9 = new RegExp(r"a(.?)(.)"); | |
102 input0 = "a\u0240bcd"; | |
103 results = ["a\u0240b", "\u0240", "b"]; | |
104 shouldBe(regex9.firstMatch(input0), results); | |
105 | |
106 var regex10 = new RegExp(r"a(.??)(.)"); | |
107 input0 = "a\xc0\x92bcd"; | |
108 results = ["a\xc0", "", "\xc0"]; | |
109 shouldBe(regex10.firstMatch(input0), results); | |
110 | |
111 var regex11 = new RegExp(r"a(.??)(.)"); | |
112 input0 = "a\u0240bcd"; | |
113 results = ["a\u0240", "", "\u0240"]; | |
114 shouldBe(regex11.firstMatch(input0), results); | |
115 | |
116 var regex12 = new RegExp(r"a(.{3})b"); | |
117 input0 = "a\u1234xyb"; | |
118 results = ["a\u1234xyb", "\u1234xy"]; | |
119 shouldBe(regex12.firstMatch(input0), results); | |
120 input1 = "a\u1234\u4321yb"; | |
121 results = ["a\u1234\u4321yb", "\u1234\u4321y"]; | |
122 shouldBe(regex12.firstMatch(input1), results); | |
123 input2 = "a\u1234\u4321\u3412b"; | |
124 results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; | |
125 shouldBe(regex12.firstMatch(input2), results); | |
126 // Failers | |
127 input3 = "a\u1234b"; | |
128 results = null; | |
129 shouldBe(regex12.firstMatch(input3), results); | |
130 input4 = "ac\ncb"; | |
131 results = null; | |
132 shouldBe(regex12.firstMatch(input4), results); | |
133 | |
134 var regex13 = new RegExp(r"a(.{3,})b"); | |
135 input0 = "a\u1234xyb"; | |
136 results = ["a\u1234xyb", "\u1234xy"]; | |
137 shouldBe(regex13.firstMatch(input0), results); | |
138 input1 = "a\u1234\u4321yb"; | |
139 results = ["a\u1234\u4321yb", "\u1234\u4321y"]; | |
140 shouldBe(regex13.firstMatch(input1), results); | |
141 input2 = "a\u1234\u4321\u3412b"; | |
142 results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; | |
143 shouldBe(regex13.firstMatch(input2), results); | |
144 input3 = "axxxxbcdefghijb"; | |
145 results = ["axxxxbcdefghijb", "xxxxbcdefghij"]; | |
146 shouldBe(regex13.firstMatch(input3), results); | |
147 input4 = "a\u1234\u4321\u3412\u3421b"; | |
148 results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; | |
149 shouldBe(regex13.firstMatch(input4), results); | |
150 // Failers | |
151 var input5 = "a\u1234b"; | |
152 results = null; | |
153 shouldBe(regex13.firstMatch(input5), results); | |
154 | |
155 var regex14 = new RegExp(r"a(.{3,}?)b"); | |
156 input0 = "a\u1234xyb"; | |
157 results = ["a\u1234xyb", "\u1234xy"]; | |
158 shouldBe(regex14.firstMatch(input0), results); | |
159 input1 = "a\u1234\u4321yb"; | |
160 results = ["a\u1234\u4321yb", "\u1234\u4321y"]; | |
161 shouldBe(regex14.firstMatch(input1), results); | |
162 input2 = "a\u1234\u4321\u3412b"; | |
163 results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; | |
164 shouldBe(regex14.firstMatch(input2), results); | |
165 input3 = "axxxxbcdefghijb"; | |
166 results = ["axxxxb", "xxxx"]; | |
167 shouldBe(regex14.firstMatch(input3), results); | |
168 input4 = "a\u1234\u4321\u3412\u3421b"; | |
169 results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; | |
170 shouldBe(regex14.firstMatch(input4), results); | |
171 // Failers | |
172 input5 = "a\u1234b"; | |
173 results = null; | |
174 shouldBe(regex14.firstMatch(input5), results); | |
175 | |
176 var regex15 = new RegExp(r"a(.{3,5})b"); | |
177 input0 = "a\u1234xyb"; | |
178 results = ["a\u1234xyb", "\u1234xy"]; | |
179 shouldBe(regex15.firstMatch(input0), results); | |
180 input1 = "a\u1234\u4321yb"; | |
181 results = ["a\u1234\u4321yb", "\u1234\u4321y"]; | |
182 shouldBe(regex15.firstMatch(input1), results); | |
183 input2 = "a\u1234\u4321\u3412b"; | |
184 results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; | |
185 shouldBe(regex15.firstMatch(input2), results); | |
186 input3 = "axxxxbcdefghijb"; | |
187 results = ["axxxxb", "xxxx"]; | |
188 shouldBe(regex15.firstMatch(input3), results); | |
189 input4 = "a\u1234\u4321\u3412\u3421b"; | |
190 results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; | |
191 shouldBe(regex15.firstMatch(input4), results); | |
192 input5 = "axbxxbcdefghijb"; | |
193 results = ["axbxxb", "xbxx"]; | |
194 shouldBe(regex15.firstMatch(input5), results); | |
195 var input6 = "axxxxxbcdefghijb"; | |
196 results = ["axxxxxb", "xxxxx"]; | |
197 shouldBe(regex15.firstMatch(input6), results); | |
198 // Failers | |
199 var input7 = "a\u1234b"; | |
200 results = null; | |
201 shouldBe(regex15.firstMatch(input7), results); | |
202 var input8 = "axxxxxxbcdefghijb"; | |
203 results = null; | |
204 shouldBe(regex15.firstMatch(input8), results); | |
205 | |
206 var regex16 = new RegExp(r"a(.{3,5}?)b"); | |
207 input0 = "a\u1234xyb"; | |
208 results = ["a\u1234xyb", "\u1234xy"]; | |
209 shouldBe(regex16.firstMatch(input0), results); | |
210 input1 = "a\u1234\u4321yb"; | |
211 results = ["a\u1234\u4321yb", "\u1234\u4321y"]; | |
212 shouldBe(regex16.firstMatch(input1), results); | |
213 input2 = "a\u1234\u4321\u3412b"; | |
214 results = ["a\u1234\u4321\u3412b", "\u1234\u4321\u3412"]; | |
215 shouldBe(regex16.firstMatch(input2), results); | |
216 input3 = "axxxxbcdefghijb"; | |
217 results = ["axxxxb", "xxxx"]; | |
218 shouldBe(regex16.firstMatch(input3), results); | |
219 input4 = "a\u1234\u4321\u3412\u3421b"; | |
220 results = ["a\u1234\u4321\u3412\u3421b", "\u1234\u4321\u3412\u3421"]; | |
221 shouldBe(regex16.firstMatch(input4), results); | |
222 input5 = "axbxxbcdefghijb"; | |
223 results = ["axbxxb", "xbxx"]; | |
224 shouldBe(regex16.firstMatch(input5), results); | |
225 input6 = "axxxxxbcdefghijb"; | |
226 results = ["axxxxxb", "xxxxx"]; | |
227 shouldBe(regex16.firstMatch(input6), results); | |
228 // Failers | |
229 input7 = "a\u1234b"; | |
230 results = null; | |
231 shouldBe(regex16.firstMatch(input7), results); | |
232 input8 = "axxxxxxbcdefghijb"; | |
233 results = null; | |
234 shouldBe(regex16.firstMatch(input8), results); | |
235 | |
236 var regex17 = new RegExp(r"^[a\u00c0]"); | |
237 // Failers | |
238 input0 = "\u0100"; | |
239 results = null; | |
240 shouldBe(regex17.firstMatch(input0), results); | |
241 | |
242 var regex21 = new RegExp(r"(?:\u0100){3}b"); | |
243 input0 = "\u0100\u0100\u0100b"; | |
244 results = ["\u0100\u0100\u0100b"]; | |
245 shouldBe(regex21.firstMatch(input0), results); | |
246 // Failers | |
247 input1 = "\u0100\u0100b"; | |
248 results = null; | |
249 shouldBe(regex21.firstMatch(input1), results); | |
250 | |
251 var regex22 = new RegExp(r"\u00ab"); | |
252 input0 = "\u00ab"; | |
253 results = ["\u00ab"]; | |
254 shouldBe(regex22.firstMatch(input0), results); | |
255 input1 = "\xc2\xab"; | |
256 results = ["\u00ab"]; | |
257 shouldBe(regex22.firstMatch(input1), results); | |
258 // Failers | |
259 input2 = "\x00{ab}"; | |
260 results = null; | |
261 shouldBe(regex22.firstMatch(input2), results); | |
262 | |
263 var regex30 = new RegExp(r"^[^a]{2}"); | |
264 input0 = "\u0100bc"; | |
265 results = ["\u0100b"]; | |
266 shouldBe(regex30.firstMatch(input0), results); | |
267 | |
268 var regex31 = new RegExp(r"^[^a]{2,}"); | |
269 input0 = "\u0100bcAa"; | |
270 results = ["\u0100bcA"]; | |
271 shouldBe(regex31.firstMatch(input0), results); | |
272 | |
273 var regex32 = new RegExp(r"^[^a]{2,}?"); | |
274 input0 = "\u0100bca"; | |
275 results = ["\u0100b"]; | |
276 shouldBe(regex32.firstMatch(input0), results); | |
277 | |
278 var regex33 = new RegExp(r"^[^a]{2}", caseSensitive: false); | |
279 input0 = "\u0100bc"; | |
280 results = ["\u0100b"]; | |
281 shouldBe(regex33.firstMatch(input0), results); | |
282 | |
283 var regex34 = new RegExp(r"^[^a]{2,}", caseSensitive: false); | |
284 input0 = "\u0100bcAa"; | |
285 results = ["\u0100bc"]; | |
286 shouldBe(regex34.firstMatch(input0), results); | |
287 | |
288 var regex35 = new RegExp(r"^[^a]{2,}?", caseSensitive: false); | |
289 input0 = "\u0100bca"; | |
290 results = ["\u0100b"]; | |
291 shouldBe(regex35.firstMatch(input0), results); | |
292 | |
293 var regex36 = new RegExp(r"\u0100{0,0}"); | |
294 input0 = "abcd"; | |
295 results = [""]; | |
296 shouldBe(regex36.firstMatch(input0), results); | |
297 | |
298 var regex37 = new RegExp(r"\u0100?"); | |
299 input0 = "abcd"; | |
300 results = [""]; | |
301 shouldBe(regex37.firstMatch(input0), results); | |
302 input1 = "\u0100\u0100"; | |
303 results = ["\u0100"]; | |
304 shouldBe(regex37.firstMatch(input1), results); | |
305 | |
306 var regex38 = new RegExp(r"\u0100{0,3}"); | |
307 input0 = "\u0100\u0100"; | |
308 results = ["\u0100\u0100"]; | |
309 shouldBe(regex38.firstMatch(input0), results); | |
310 input1 = "\u0100\u0100\u0100\u0100"; | |
311 results = ["\u0100\u0100\u0100"]; | |
312 shouldBe(regex38.firstMatch(input1), results); | |
313 | |
314 var regex39 = new RegExp(r"\u0100*"); | |
315 input0 = "abce"; | |
316 results = [""]; | |
317 shouldBe(regex39.firstMatch(input0), results); | |
318 input1 = "\u0100\u0100\u0100\u0100"; | |
319 results = ["\u0100\u0100\u0100\u0100"]; | |
320 shouldBe(regex39.firstMatch(input1), results); | |
321 | |
322 var regex40 = new RegExp(r"\u0100{1,1}"); | |
323 input0 = "abcd\u0100\u0100\u0100\u0100"; | |
324 results = ["\u0100"]; | |
325 shouldBe(regex40.firstMatch(input0), results); | |
326 | |
327 var regex41 = new RegExp(r"\u0100{1,3}"); | |
328 input0 = "abcd\u0100\u0100\u0100\u0100"; | |
329 results = ["\u0100\u0100\u0100"]; | |
330 shouldBe(regex41.firstMatch(input0), results); | |
331 | |
332 var regex42 = new RegExp(r"\u0100+"); | |
333 input0 = "abcd\u0100\u0100\u0100\u0100"; | |
334 results = ["\u0100\u0100\u0100\u0100"]; | |
335 shouldBe(regex42.firstMatch(input0), results); | |
336 | |
337 var regex43 = new RegExp(r"\u0100{3}"); | |
338 input0 = "abcd\u0100\u0100\u0100XX"; | |
339 results = ["\u0100\u0100\u0100"]; | |
340 shouldBe(regex43.firstMatch(input0), results); | |
341 | |
342 var regex44 = new RegExp(r"\u0100{3,5}"); | |
343 input0 = "abcd\u0100\u0100\u0100\u0100\u0100\u0100\u0100XX"; | |
344 results = ["\u0100\u0100\u0100\u0100\u0100"]; | |
345 shouldBe(regex44.firstMatch(input0), results); | |
346 | |
347 var regex45 = new RegExp(r"\u0100{3,}"); | |
348 input0 = "abcd\u0100\u0100\u0100\u0100\u0100\u0100\u0100XX"; | |
349 results = ["\u0100\u0100\u0100\u0100\u0100\u0100\u0100"]; | |
350 shouldBe(regex45.firstMatch(input0), results); | |
351 | |
352 var regex47 = new RegExp(r"\D*"); | |
353 input0 = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; | |
354 results = ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"]; | |
355 shouldBe(regex47.firstMatch(input0), results); | |
356 | |
357 var regex48 = new RegExp(r"\D*"); | |
358 input0 = "\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100"; | |
359 results = ["\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u
0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u01
00\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100
\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100\u0100"]; | |
360 shouldBe(regex48.firstMatch(input0), results); | |
361 | |
362 var regex49 = new RegExp(r"\D"); | |
363 input0 = "1X2"; | |
364 results = ["X"]; | |
365 shouldBe(regex49.firstMatch(input0), results); | |
366 input1 = "1\u01002"; | |
367 results = ["\u0100"]; | |
368 shouldBe(regex49.firstMatch(input1), results); | |
369 | |
370 var regex50 = new RegExp(r">\S"); | |
371 input0 = "> >X Y"; | |
372 results = [">X"]; | |
373 shouldBe(regex50.firstMatch(input0), results); | |
374 input1 = "> >\u0100 Y"; | |
375 results = [">\u0100"]; | |
376 shouldBe(regex50.firstMatch(input1), results); | |
377 | |
378 var regex51 = new RegExp(r"\d"); | |
379 input0 = "\u01003"; | |
380 results = ["3"]; | |
381 shouldBe(regex51.firstMatch(input0), results); | |
382 | |
383 var regex52 = new RegExp(r"\s"); | |
384 input0 = "\u0100 X"; | |
385 results = [" "]; | |
386 shouldBe(regex52.firstMatch(input0), results); | |
387 | |
388 var regex53 = new RegExp(r"\D+"); | |
389 input0 = "12abcd34"; | |
390 results = ["abcd"]; | |
391 shouldBe(regex53.firstMatch(input0), results); | |
392 // Failers | |
393 input1 = "1234"; | |
394 results = null; | |
395 shouldBe(regex53.firstMatch(input1), results); | |
396 | |
397 var regex54 = new RegExp(r"\D{2,3}"); | |
398 input0 = "12abcd34"; | |
399 results = ["abc"]; | |
400 shouldBe(regex54.firstMatch(input0), results); | |
401 input1 = "12ab34"; | |
402 results = ["ab"]; | |
403 shouldBe(regex54.firstMatch(input1), results); | |
404 // Failers | |
405 input2 = "1234"; | |
406 results = null; | |
407 shouldBe(regex54.firstMatch(input2), results); | |
408 input3 = "12a34"; | |
409 results = null; | |
410 shouldBe(regex54.firstMatch(input3), results); | |
411 | |
412 var regex55 = new RegExp(r"\D{2,3}?"); | |
413 input0 = "12abcd34"; | |
414 results = ["ab"]; | |
415 shouldBe(regex55.firstMatch(input0), results); | |
416 input1 = "12ab34"; | |
417 results = ["ab"]; | |
418 shouldBe(regex55.firstMatch(input1), results); | |
419 // Failers | |
420 input2 = "1234"; | |
421 results = null; | |
422 shouldBe(regex55.firstMatch(input2), results); | |
423 input3 = "12a34"; | |
424 results = null; | |
425 shouldBe(regex55.firstMatch(input3), results); | |
426 | |
427 var regex56 = new RegExp(r"\d+"); | |
428 input0 = "12abcd34"; | |
429 results = ["12"]; | |
430 shouldBe(regex56.firstMatch(input0), results); | |
431 | |
432 var regex57 = new RegExp(r"\d{2,3}"); | |
433 input0 = "12abcd34"; | |
434 results = ["12"]; | |
435 shouldBe(regex57.firstMatch(input0), results); | |
436 input1 = "1234abcd"; | |
437 results = ["123"]; | |
438 shouldBe(regex57.firstMatch(input1), results); | |
439 // Failers | |
440 input2 = "1.4"; | |
441 results = null; | |
442 shouldBe(regex57.firstMatch(input2), results); | |
443 | |
444 var regex58 = new RegExp(r"\d{2,3}?"); | |
445 input0 = "12abcd34"; | |
446 results = ["12"]; | |
447 shouldBe(regex58.firstMatch(input0), results); | |
448 input1 = "1234abcd"; | |
449 results = ["12"]; | |
450 shouldBe(regex58.firstMatch(input1), results); | |
451 // Failers | |
452 input2 = "1.4"; | |
453 results = null; | |
454 shouldBe(regex58.firstMatch(input2), results); | |
455 | |
456 var regex59 = new RegExp(r"\S+"); | |
457 input0 = "12abcd34"; | |
458 results = ["12abcd34"]; | |
459 shouldBe(regex59.firstMatch(input0), results); | |
460 // Failers | |
461 input1 = " "; | |
462 results = null; | |
463 shouldBe(regex59.firstMatch(input1), results); | |
464 | |
465 var regex60 = new RegExp(r"\S{2,3}"); | |
466 input0 = "12abcd34"; | |
467 results = ["12a"]; | |
468 shouldBe(regex60.firstMatch(input0), results); | |
469 input1 = "1234abcd"; | |
470 results = ["123"]; | |
471 shouldBe(regex60.firstMatch(input1), results); | |
472 // Failers | |
473 input2 = " "; | |
474 results = null; | |
475 shouldBe(regex60.firstMatch(input2), results); | |
476 | |
477 var regex61 = new RegExp(r"\S{2,3}?"); | |
478 input0 = "12abcd34"; | |
479 results = ["12"]; | |
480 shouldBe(regex61.firstMatch(input0), results); | |
481 input1 = "1234abcd"; | |
482 results = ["12"]; | |
483 shouldBe(regex61.firstMatch(input1), results); | |
484 // Failers | |
485 input2 = " "; | |
486 results = null; | |
487 shouldBe(regex61.firstMatch(input2), results); | |
488 | |
489 var regex62 = new RegExp(r">\s+<"); | |
490 input0 = "12> <34"; | |
491 results = ["> <"]; | |
492 shouldBe(regex62.firstMatch(input0), results); | |
493 | |
494 var regex63 = new RegExp(r">\s{2,3}<"); | |
495 input0 = "ab> <cd"; | |
496 results = ["> <"]; | |
497 shouldBe(regex63.firstMatch(input0), results); | |
498 input1 = "ab> <ce"; | |
499 results = ["> <"]; | |
500 shouldBe(regex63.firstMatch(input1), results); | |
501 // Failers | |
502 input2 = "ab> <cd"; | |
503 results = null; | |
504 shouldBe(regex63.firstMatch(input2), results); | |
505 | |
506 var regex64 = new RegExp(r">\s{2,3}?<"); | |
507 input0 = "ab> <cd"; | |
508 results = ["> <"]; | |
509 shouldBe(regex64.firstMatch(input0), results); | |
510 input1 = "ab> <ce"; | |
511 results = ["> <"]; | |
512 shouldBe(regex64.firstMatch(input1), results); | |
513 // Failers | |
514 input2 = "ab> <cd"; | |
515 results = null; | |
516 shouldBe(regex64.firstMatch(input2), results); | |
517 | |
518 var regex65 = new RegExp(r"\w+"); | |
519 input0 = "12 34"; | |
520 results = ["12"]; | |
521 shouldBe(regex65.firstMatch(input0), results); | |
522 // Failers | |
523 input1 = "+++=*!"; | |
524 results = null; | |
525 shouldBe(regex65.firstMatch(input1), results); | |
526 | |
527 var regex66 = new RegExp(r"\w{2,3}"); | |
528 input0 = "ab cd"; | |
529 results = ["ab"]; | |
530 shouldBe(regex66.firstMatch(input0), results); | |
531 input1 = "abcd ce"; | |
532 results = ["abc"]; | |
533 shouldBe(regex66.firstMatch(input1), results); | |
534 // Failers | |
535 input2 = "a.b.c"; | |
536 results = null; | |
537 shouldBe(regex66.firstMatch(input2), results); | |
538 | |
539 var regex67 = new RegExp(r"\w{2,3}?"); | |
540 input0 = "ab cd"; | |
541 results = ["ab"]; | |
542 shouldBe(regex67.firstMatch(input0), results); | |
543 input1 = "abcd ce"; | |
544 results = ["ab"]; | |
545 shouldBe(regex67.firstMatch(input1), results); | |
546 // Failers | |
547 input2 = "a.b.c"; | |
548 results = null; | |
549 shouldBe(regex67.firstMatch(input2), results); | |
550 | |
551 var regex68 = new RegExp(r"\W+"); | |
552 input0 = "12====34"; | |
553 results = ["===="]; | |
554 shouldBe(regex68.firstMatch(input0), results); | |
555 // Failers | |
556 input1 = "abcd"; | |
557 results = null; | |
558 shouldBe(regex68.firstMatch(input1), results); | |
559 | |
560 var regex69 = new RegExp(r"\W{2,3}"); | |
561 input0 = "ab====cd"; | |
562 results = ["==="]; | |
563 shouldBe(regex69.firstMatch(input0), results); | |
564 input1 = "ab==cd"; | |
565 results = ["=="]; | |
566 shouldBe(regex69.firstMatch(input1), results); | |
567 // Failers | |
568 input2 = "a.b.c"; | |
569 results = null; | |
570 shouldBe(regex69.firstMatch(input2), results); | |
571 | |
572 var regex70 = new RegExp(r"\W{2,3}?"); | |
573 input0 = "ab====cd"; | |
574 results = ["=="]; | |
575 shouldBe(regex70.firstMatch(input0), results); | |
576 input1 = "ab==cd"; | |
577 results = ["=="]; | |
578 shouldBe(regex70.firstMatch(input1), results); | |
579 // Failers | |
580 input2 = "a.b.c"; | |
581 results = null; | |
582 shouldBe(regex70.firstMatch(input2), results); | |
583 | |
584 var regex71 = new RegExp(r"[\u0100]"); | |
585 input0 = "\u0100"; | |
586 results = ["\u0100"]; | |
587 shouldBe(regex71.firstMatch(input0), results); | |
588 input1 = "Z\u0100"; | |
589 results = ["\u0100"]; | |
590 shouldBe(regex71.firstMatch(input1), results); | |
591 input2 = "\u0100Z"; | |
592 results = ["\u0100"]; | |
593 shouldBe(regex71.firstMatch(input2), results); | |
594 | |
595 var regex72 = new RegExp(r"[Z\u0100]"); | |
596 input0 = "Z\u0100"; | |
597 results = ["Z"]; | |
598 shouldBe(regex72.firstMatch(input0), results); | |
599 input1 = "\u0100"; | |
600 results = ["\u0100"]; | |
601 shouldBe(regex72.firstMatch(input1), results); | |
602 input2 = "\u0100Z"; | |
603 results = ["\u0100"]; | |
604 shouldBe(regex72.firstMatch(input2), results); | |
605 | |
606 var regex73 = new RegExp(r"[\u0100\u0200]"); | |
607 input0 = "ab\u0100cd"; | |
608 results = ["\u0100"]; | |
609 shouldBe(regex73.firstMatch(input0), results); | |
610 input1 = "ab\u0200cd"; | |
611 results = ["\u0200"]; | |
612 shouldBe(regex73.firstMatch(input1), results); | |
613 | |
614 var regex74 = new RegExp(r"[\u0100-\u0200]"); | |
615 input0 = "ab\u0100cd"; | |
616 results = ["\u0100"]; | |
617 shouldBe(regex74.firstMatch(input0), results); | |
618 input1 = "ab\u0200cd"; | |
619 results = ["\u0200"]; | |
620 shouldBe(regex74.firstMatch(input1), results); | |
621 input2 = "ab\u0111cd"; | |
622 results = ["\u0111"]; | |
623 shouldBe(regex74.firstMatch(input2), results); | |
624 | |
625 var regex75 = new RegExp(r"[z-\u0200]"); | |
626 input0 = "ab\u0100cd"; | |
627 results = ["\u0100"]; | |
628 shouldBe(regex75.firstMatch(input0), results); | |
629 input1 = "ab\u0200cd"; | |
630 results = ["\u0200"]; | |
631 shouldBe(regex75.firstMatch(input1), results); | |
632 input2 = "ab\u0111cd"; | |
633 results = ["\u0111"]; | |
634 shouldBe(regex75.firstMatch(input2), results); | |
635 input3 = "abzcd"; | |
636 results = ["z"]; | |
637 shouldBe(regex75.firstMatch(input3), results); | |
638 input4 = "ab|cd"; | |
639 results = ["|"]; | |
640 shouldBe(regex75.firstMatch(input4), results); | |
641 | |
642 var regex76 = new RegExp(r"[Q\u0100\u0200]"); | |
643 input0 = "ab\u0100cd"; | |
644 results = ["\u0100"]; | |
645 shouldBe(regex76.firstMatch(input0), results); | |
646 input1 = "ab\u0200cd"; | |
647 results = ["\u0200"]; | |
648 shouldBe(regex76.firstMatch(input1), results); | |
649 input2 = "Q?"; | |
650 results = ["Q"]; | |
651 shouldBe(regex76.firstMatch(input2), results); | |
652 | |
653 var regex77 = new RegExp(r"[Q\u0100-\u0200]"); | |
654 input0 = "ab\u0100cd"; | |
655 results = ["\u0100"]; | |
656 shouldBe(regex77.firstMatch(input0), results); | |
657 input1 = "ab\u0200cd"; | |
658 results = ["\u0200"]; | |
659 shouldBe(regex77.firstMatch(input1), results); | |
660 input2 = "ab\u0111cd"; | |
661 results = ["\u0111"]; | |
662 shouldBe(regex77.firstMatch(input2), results); | |
663 input3 = "Q?"; | |
664 results = ["Q"]; | |
665 shouldBe(regex77.firstMatch(input3), results); | |
666 | |
667 var regex78 = new RegExp(r"[Qz-\u0200]"); | |
668 input0 = "ab\u0100cd"; | |
669 results = ["\u0100"]; | |
670 shouldBe(regex78.firstMatch(input0), results); | |
671 input1 = "ab\u0200cd"; | |
672 results = ["\u0200"]; | |
673 shouldBe(regex78.firstMatch(input1), results); | |
674 input2 = "ab\u0111cd"; | |
675 results = ["\u0111"]; | |
676 shouldBe(regex78.firstMatch(input2), results); | |
677 input3 = "abzcd"; | |
678 results = ["z"]; | |
679 shouldBe(regex78.firstMatch(input3), results); | |
680 input4 = "ab|cd"; | |
681 results = ["|"]; | |
682 shouldBe(regex78.firstMatch(input4), results); | |
683 input5 = "Q?"; | |
684 results = ["Q"]; | |
685 shouldBe(regex78.firstMatch(input5), results); | |
686 | |
687 var regex79 = new RegExp(r"[\u0100\u0200]{1,3}"); | |
688 input0 = "ab\u0100cd"; | |
689 results = ["\u0100"]; | |
690 shouldBe(regex79.firstMatch(input0), results); | |
691 input1 = "ab\u0200cd"; | |
692 results = ["\u0200"]; | |
693 shouldBe(regex79.firstMatch(input1), results); | |
694 input2 = "ab\u0200\u0100\u0200\u0100cd"; | |
695 results = ["\u0200\u0100\u0200"]; | |
696 shouldBe(regex79.firstMatch(input2), results); | |
697 | |
698 var regex80 = new RegExp(r"[\u0100\u0200]{1,3}?"); | |
699 input0 = "ab\u0100cd"; | |
700 results = ["\u0100"]; | |
701 shouldBe(regex80.firstMatch(input0), results); | |
702 input1 = "ab\u0200cd"; | |
703 results = ["\u0200"]; | |
704 shouldBe(regex80.firstMatch(input1), results); | |
705 input2 = "ab\u0200\u0100\u0200\u0100cd"; | |
706 results = ["\u0200"]; | |
707 shouldBe(regex80.firstMatch(input2), results); | |
708 | |
709 var regex81 = new RegExp(r"[Q\u0100\u0200]{1,3}"); | |
710 input0 = "ab\u0100cd"; | |
711 results = ["\u0100"]; | |
712 shouldBe(regex81.firstMatch(input0), results); | |
713 input1 = "ab\u0200cd"; | |
714 results = ["\u0200"]; | |
715 shouldBe(regex81.firstMatch(input1), results); | |
716 input2 = "ab\u0200\u0100\u0200\u0100cd"; | |
717 results = ["\u0200\u0100\u0200"]; | |
718 shouldBe(regex81.firstMatch(input2), results); | |
719 | |
720 var regex82 = new RegExp(r"[Q\u0100\u0200]{1,3}?"); | |
721 input0 = "ab\u0100cd"; | |
722 results = ["\u0100"]; | |
723 shouldBe(regex82.firstMatch(input0), results); | |
724 input1 = "ab\u0200cd"; | |
725 results = ["\u0200"]; | |
726 shouldBe(regex82.firstMatch(input1), results); | |
727 input2 = "ab\u0200\u0100\u0200\u0100cd"; | |
728 results = ["\u0200"]; | |
729 shouldBe(regex82.firstMatch(input2), results); | |
730 | |
731 var regex86 = new RegExp(r"[^\u0100\u0200]X"); | |
732 input0 = "AX"; | |
733 results = ["AX"]; | |
734 shouldBe(regex86.firstMatch(input0), results); | |
735 input1 = "\u0150X"; | |
736 results = ["\u0150X"]; | |
737 shouldBe(regex86.firstMatch(input1), results); | |
738 input2 = "\u0500X"; | |
739 results = ["\u0500X"]; | |
740 shouldBe(regex86.firstMatch(input2), results); | |
741 // Failers | |
742 input3 = "\u0100X"; | |
743 results = null; | |
744 shouldBe(regex86.firstMatch(input3), results); | |
745 input4 = "\u0200X"; | |
746 results = null; | |
747 shouldBe(regex86.firstMatch(input4), results); | |
748 | |
749 var regex87 = new RegExp(r"[^Q\u0100\u0200]X"); | |
750 input0 = "AX"; | |
751 results = ["AX"]; | |
752 shouldBe(regex87.firstMatch(input0), results); | |
753 input1 = "\u0150X"; | |
754 results = ["\u0150X"]; | |
755 shouldBe(regex87.firstMatch(input1), results); | |
756 input2 = "\u0500X"; | |
757 results = ["\u0500X"]; | |
758 shouldBe(regex87.firstMatch(input2), results); | |
759 // Failers | |
760 input3 = "\u0100X"; | |
761 results = null; | |
762 shouldBe(regex87.firstMatch(input3), results); | |
763 input4 = "\u0200X"; | |
764 results = null; | |
765 shouldBe(regex87.firstMatch(input4), results); | |
766 input5 = "QX"; | |
767 results = null; | |
768 shouldBe(regex87.firstMatch(input5), results); | |
769 | |
770 var regex88 = new RegExp(r"[^\u0100-\u0200]X"); | |
771 input0 = "AX"; | |
772 results = ["AX"]; | |
773 shouldBe(regex88.firstMatch(input0), results); | |
774 input1 = "\u0500X"; | |
775 results = ["\u0500X"]; | |
776 shouldBe(regex88.firstMatch(input1), results); | |
777 // Failers | |
778 input2 = "\u0100X"; | |
779 results = null; | |
780 shouldBe(regex88.firstMatch(input2), results); | |
781 input3 = "\u0150X"; | |
782 results = null; | |
783 shouldBe(regex88.firstMatch(input3), results); | |
784 input4 = "\u0200X"; | |
785 results = null; | |
786 shouldBe(regex88.firstMatch(input4), results); | |
787 | |
788 var regex91 = new RegExp(r"[z-\u0100]", caseSensitive: false); | |
789 input0 = "z"; | |
790 results = ["z"]; | |
791 shouldBe(regex91.firstMatch(input0), results); | |
792 input1 = "Z"; | |
793 results = ["Z"]; | |
794 shouldBe(regex91.firstMatch(input1), results); | |
795 input2 = "\u0100"; | |
796 results = ["\u0100"]; | |
797 shouldBe(regex91.firstMatch(input2), results); | |
798 // Failers | |
799 input3 = "\u0102"; | |
800 results = null; | |
801 shouldBe(regex91.firstMatch(input3), results); | |
802 input4 = "y"; | |
803 results = null; | |
804 shouldBe(regex91.firstMatch(input4), results); | |
805 | |
806 var regex92 = new RegExp(r"[\xFF]"); | |
807 input0 = ">\xff<"; | |
808 results = ["\xff"]; | |
809 shouldBe(regex92.firstMatch(input0), results); | |
810 | |
811 var regex93 = new RegExp(r"[\xff]"); | |
812 input0 = ">\u00ff<"; | |
813 results = ["\u00ff"]; | |
814 shouldBe(regex93.firstMatch(input0), results); | |
815 | |
816 var regex94 = new RegExp(r"[^\xFF]"); | |
817 input0 = "XYZ"; | |
818 results = ["X"]; | |
819 shouldBe(regex94.firstMatch(input0), results); | |
820 | |
821 var regex95 = new RegExp(r"[^\xff]"); | |
822 input0 = "XYZ"; | |
823 results = ["X"]; | |
824 shouldBe(regex95.firstMatch(input0), results); | |
825 input1 = "\u0123"; | |
826 results = ["\u0123"]; | |
827 shouldBe(regex95.firstMatch(input1), results); | |
828 | |
829 var regex96 = new RegExp(r"^[ac]*b"); | |
830 input0 = "xb"; | |
831 results = null; | |
832 shouldBe(regex96.firstMatch(input0), results); | |
833 | |
834 var regex97 = new RegExp(r"^[ac\u0100]*b"); | |
835 input0 = "xb"; | |
836 results = null; | |
837 shouldBe(regex97.firstMatch(input0), results); | |
838 | |
839 var regex98 = new RegExp(r"^[^x]*b", caseSensitive: false); | |
840 input0 = "xb"; | |
841 results = null; | |
842 shouldBe(regex98.firstMatch(input0), results); | |
843 | |
844 var regex99 = new RegExp(r"^[^x]*b"); | |
845 input0 = "xb"; | |
846 results = null; | |
847 shouldBe(regex99.firstMatch(input0), results); | |
848 | |
849 var regex100 = new RegExp(r"^\d*b"); | |
850 input0 = "xb"; | |
851 results = null; | |
852 shouldBe(regex100.firstMatch(input0), results); | |
853 | |
854 var regex102 = new RegExp(r"^\u0085$", caseSensitive: false); | |
855 input0 = "\u0085"; | |
856 results = ["\u0085"]; | |
857 shouldBe(regex102.firstMatch(input0), results); | |
858 | |
859 var regex103 = new RegExp(r"^\xe1\x88\xb4"); | |
860 input0 = "\xe1\x88\xb4"; | |
861 results = ["\xe1\x88\xb4"]; | |
862 shouldBe(regex103.firstMatch(input0), results); | |
863 | |
864 var regex104 = new RegExp(r"^\xe1\x88\xb4"); | |
865 input0 = "\xe1\x88\xb4"; | |
866 results = ["\xe1\x88\xb4"]; | |
867 shouldBe(regex104.firstMatch(input0), results); | |
868 | |
869 var regex105 = new RegExp(r"(.{1,5})"); | |
870 input0 = "abcdefg"; | |
871 results = ["abcde", "abcde"]; | |
872 shouldBe(regex105.firstMatch(input0), results); | |
873 input1 = "ab"; | |
874 results = ["ab", "ab"]; | |
875 shouldBe(regex105.firstMatch(input1), results); | |
876 | |
877 var regex106 = new RegExp(r"a*\u0100*\w"); | |
878 input0 = "a"; | |
879 results = ["a"]; | |
880 shouldBe(regex106.firstMatch(input0), results); | |
881 | |
882 var regex107 = new RegExp(r"[\S\s]*"); | |
883 input0 = "abc\n\r\u0442\u0435\u0441\u0442xyz"; | |
884 results = ["abc\u000a\u000d\u0442\u0435\u0441\u0442xyz"]; | |
885 shouldBe(regex107.firstMatch(input0), results); | |
886 | |
887 var regexGlobal0 = new RegExp(r"[^a]+"); | |
888 input0 = "bcd"; | |
889 results = ["bcd"]; | |
890 shouldBe(firstMatch(input0, regexGlobal0), results); | |
891 input1 = "\u0100aY\u0256Z"; | |
892 results = ["\u0100", "Y\u0256Z"]; | |
893 Expect.listEquals(regexGlobal0.allMatches(input1) | |
894 .map((m) => m.group(0)).toList(), | |
895 results); | |
896 | |
897 var regexGlobal1 = new RegExp(r"\S\S"); | |
898 input0 = "A\u00a3BC"; | |
899 results = ["A\u00a3", "BC"]; | |
900 Expect.listEquals(allStringMatches(input0, regexGlobal1), results); | |
901 | |
902 var regexGlobal2 = new RegExp(r"\S{2}"); | |
903 input0 = "A\u00a3BC"; | |
904 results = ["A\u00a3", "BC"]; | |
905 Expect.listEquals(allStringMatches(input0, regexGlobal2), results); | |
906 | |
907 var regexGlobal3 = new RegExp(r"\W\W"); | |
908 input0 = "+\u00a3=="; | |
909 results = ["+\u00a3", "=="]; | |
910 Expect.listEquals(allStringMatches(input0, regexGlobal3), results); | |
911 | |
912 var regexGlobal4 = new RegExp(r"\W{2}"); | |
913 input0 = "+\u00a3=="; | |
914 results = ["+\u00a3", "=="]; | |
915 Expect.listEquals(allStringMatches(input0, regexGlobal4), results); | |
916 | |
917 var regexGlobal5 = new RegExp(r"\S"); | |
918 input0 = "\u0442\u0435\u0441\u0442"; | |
919 results = ["\u0442", "\u0435", "\u0441", "\u0442"]; | |
920 Expect.listEquals(allStringMatches(input0, regexGlobal5), results); | |
921 | |
922 var regexGlobal6 = new RegExp(r"[\S]"); | |
923 input0 = "\u0442\u0435\u0441\u0442"; | |
924 results = ["\u0442", "\u0435", "\u0441", "\u0442"]; | |
925 Expect.listEquals(allStringMatches(input0, regexGlobal6), results); | |
926 | |
927 var regexGlobal7 = new RegExp(r"\D"); | |
928 input0 = "\u0442\u0435\u0441\u0442"; | |
929 results = ["\u0442", "\u0435", "\u0441", "\u0442"]; | |
930 Expect.listEquals(allStringMatches(input0, regexGlobal7), results); | |
931 | |
932 var regexGlobal8 = new RegExp(r"[\D]"); | |
933 input0 = "\u0442\u0435\u0441\u0442"; | |
934 results = ["\u0442", "\u0435", "\u0441", "\u0442"]; | |
935 Expect.listEquals(allStringMatches(input0, regexGlobal8), results); | |
936 | |
937 var regexGlobal9 = new RegExp(r"\W"); | |
938 input0 = "\u2442\u2435\u2441\u2442"; | |
939 results = ["\u2442", "\u2435", "\u2441", "\u2442"]; | |
940 Expect.listEquals(allStringMatches(input0, regexGlobal9), results); | |
941 | |
942 var regexGlobal10 = new RegExp(r"[\W]"); | |
943 input0 = "\u2442\u2435\u2441\u2442"; | |
944 results = ["\u2442", "\u2435", "\u2441", "\u2442"]; | |
945 Expect.listEquals(allStringMatches(input0, regexGlobal10), results); | |
946 | |
947 var regexGlobal11 = new RegExp(r"[\u041f\S]"); | |
948 input0 = "\u0442\u0435\u0441\u0442"; | |
949 results = ["\u0442", "\u0435", "\u0441", "\u0442"]; | |
950 Expect.listEquals(allStringMatches(input0, regexGlobal11), results); | |
951 | |
952 var regexGlobal12 = new RegExp(r".[^\S]."); | |
953 input0 = "abc def\u0442\u0443xyz\npqr"; | |
954 results = ["c d", "z\u000ap"]; | |
955 Expect.listEquals(allStringMatches(input0, regexGlobal12), results); | |
956 | |
957 var regexGlobal13 = new RegExp(r".[^\S\n]."); | |
958 input0 = "abc def\u0442\u0443xyz\npqr"; | |
959 results = ["c d"]; | |
960 Expect.listEquals(allStringMatches(input0, regexGlobal13), results); | |
961 | |
962 var regexGlobal14 = new RegExp(r"[\W]"); | |
963 input0 = "+\u2442"; | |
964 results = ["+", "\u2442"]; | |
965 Expect.listEquals(allStringMatches(input0, regexGlobal14), results); | |
966 | |
967 var regexGlobal15 = new RegExp(r"[^a-zA-Z]"); | |
968 input0 = "+\u2442"; | |
969 results = ["+", "\u2442"]; | |
970 Expect.listEquals(allStringMatches(input0, regexGlobal15), results); | |
971 | |
972 var regexGlobal16 = new RegExp(r"[^a-zA-Z]"); | |
973 input0 = "A\u0442"; | |
974 results = ["\u0442"]; | |
975 Expect.listEquals(allStringMatches(input0, regexGlobal16), results); | |
976 | |
977 var regexGlobal17 = new RegExp(r"[\S]"); | |
978 input0 = "A\u0442"; | |
979 results = ["A", "\u0442"]; | |
980 Expect.listEquals(allStringMatches(input0, regexGlobal17), results); | |
981 | |
982 var regexGlobal19 = new RegExp(r"[\D]"); | |
983 input0 = "A\u0442"; | |
984 results = ["A", "\u0442"]; | |
985 Expect.listEquals(allStringMatches(input0, regexGlobal19), results); | |
986 | |
987 var regexGlobal21 = new RegExp(r"[^a-z]"); | |
988 input0 = "A\u0422"; | |
989 results = ["A", "\u0422"]; | |
990 Expect.listEquals(allStringMatches(input0, regexGlobal21), results); | |
991 | |
992 var regexGlobal24 = new RegExp(r"[\S]"); | |
993 input0 = "A\u0442"; | |
994 results = ["A", "\u0442"]; | |
995 Expect.listEquals(allStringMatches(input0, regexGlobal24), results); | |
996 | |
997 var regexGlobal25 = new RegExp(r"[^A-Z]"); | |
998 input0 = "a\u0442"; | |
999 results = ["a", "\u0442"]; | |
1000 Expect.listEquals(allStringMatches(input0, regexGlobal25), results); | |
1001 | |
1002 var regexGlobal26 = new RegExp(r"[\W]"); | |
1003 input0 = "+\u2442"; | |
1004 results = ["+", "\u2442"]; | |
1005 Expect.listEquals(allStringMatches(input0, regexGlobal26), results); | |
1006 | |
1007 var regexGlobal27 = new RegExp(r"[\D]"); | |
1008 input0 = "M\u0442"; | |
1009 results = ["M", "\u0442"]; | |
1010 Expect.listEquals(allStringMatches(input0, regexGlobal27), results); | |
1011 | |
1012 var regexGlobal28 = new RegExp(r"[^a]+", caseSensitive: false); | |
1013 input0 = "bcd"; | |
1014 results = ["bcd"]; | |
1015 Expect.listEquals(allStringMatches(input0, regexGlobal28), results); | |
1016 input1 = "\u0100aY\u0256Z"; | |
1017 results = ["\u0100", "Y\u0256Z"]; | |
1018 Expect.listEquals(allStringMatches(input1, regexGlobal28), results); | |
1019 | |
1020 var regexGlobal29 = new RegExp(r"(a|)"); | |
1021 input0 = "catac"; | |
1022 results = ["", "a", "", "a", "", ""]; | |
1023 Expect.listEquals(allStringMatches(input0, regexGlobal29), results); | |
1024 input1 = "a\u0256a"; | |
1025 results = ["a", "", "a", ""]; | |
1026 Expect.listEquals(allStringMatches(input1, regexGlobal29), results); | |
1027 } | |
OLD | NEW |