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