1//
2// Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
3// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4//
5// This code is free software; you can redistribute it and/or modify it
6// under the terms of the GNU General Public License version 2 only, as
7// published by the Free Software Foundation.
8//
9// This code is distributed in the hope that it will be useful, but WITHOUT
10// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12// version 2 for more details (a copy is included in the LICENSE file that
13// accompanied this code).
14//
15// You should have received a copy of the GNU General Public License version
16// 2 along with this work; if not, write to the Free Software Foundation,
17// Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20// or visit www.oracle.com if you need additional information or have any
21// questions.
22//
23// --------------------------------------------------------
24// This file contains test cases with supplementary characters for regular expressions.
25// A test case consists of three lines:
26// The first line is a pattern used in the test
27// The second line is the input to search for the pattern in
28// The third line is a concatentation of the match, the number of groups,
29//     and the contents of the first four subexpressions.
30// Empty lines and lines beginning with comment slashes are ignored.
31
32// Test unsetting of backed off groups
33^(\ud800\udc61)?\ud800\udc61
34\ud800\udc61
35true \ud800\udc61 1
36
37^(\ud800\udc61\ud800)?\ud800\udc61\ud800
38\ud800\udc61\ud800
39true \ud800\udc61\ud800 1
40
41^(\ud800\udc61\ud800\udc61(\ud800\udc62\ud800\udc62)?)+$
42\ud800\udc61\ud800\udc61\ud800\udc62\ud800\udc62\ud800\udc61\ud800\udc61
43true \ud800\udc61\ud800\udc61\ud800\udc62\ud800\udc62\ud800\udc61\ud800\udc61 2 \ud800\udc61\ud800\udc61 \ud800\udc62\ud800\udc62
44
45^(\ud800\udc61\ud800\udc61\ud800(\ud800\udc62\ud800\udc62\ud800)?)+$
46\ud800\udc61\ud800\udc61\ud800\ud800\udc62\ud800\udc62\ud800\ud800\udc61\ud800\udc61\ud800
47true \ud800\udc61\ud800\udc61\ud800\ud800\udc62\ud800\udc62\ud800\ud800\udc61\ud800\udc61\ud800 2 \ud800\udc61\ud800\udc61\ud800 \ud800\udc62\ud800\udc62\ud800
48
49((\ud800\udc61|\ud800\udc62)?\ud800\udc62)+
50\ud800\udc62
51true \ud800\udc62 2 \ud800\udc62
52
53((\ud800|\ud800\udc62)?\ud800\udc62)+
54\ud800\udc62
55true \ud800\udc62 2 \ud800\udc62
56
57(\ud800\udc61\ud800\udc61\ud800\udc61)?\ud800\udc61\ud800\udc61\ud800\udc61
58\ud800\udc61\ud800\udc61\ud800\udc61
59true \ud800\udc61\ud800\udc61\ud800\udc61 1
60
61(\ud800\udc61\ud800\udc61\ud800\ud800\udc61)?\ud800\udc61\ud800\udc61\ud800\ud800\udc61
62\ud800\udc61\ud800\udc61\ud800\ud800\udc61
63true \ud800\udc61\ud800\udc61\ud800\ud800\udc61 1
64
65^(\ud800\udc61\ud800(\ud800\udc62\ud800)?)+$
66\ud800\udc61\ud800\ud800\udc62\ud800\ud800\udc61\ud800
67true \ud800\udc61\ud800\ud800\udc62\ud800\ud800\udc61\ud800 2 \ud800\udc61\ud800 \ud800\udc62\ud800
68
69^(\ud800\udc61(\ud800\udc62)?)+$
70\ud800\udc61\ud800\udc62\ud800\udc61
71true \ud800\udc61\ud800\udc62\ud800\udc61 2 \ud800\udc61 \ud800\udc62
72
73^(\ud800\udc61\ud800(\ud800\udc62\ud800)?)+$
74\ud800\udc61\ud800\ud800\udc62\ud800\ud800\udc61\ud800
75true \ud800\udc61\ud800\ud800\udc62\ud800\ud800\udc61\ud800 2 \ud800\udc61\ud800 \ud800\udc62\ud800
76
77^(\ud800\udc61(\ud800\udc62(\ud800\udc63)?)?)?\ud800\udc61\ud800\udc62\ud800\udc63
78\ud800\udc61\ud800\udc62\ud800\udc63
79true \ud800\udc61\ud800\udc62\ud800\udc63 3
80
81^(\ud800\udc61\ud800(\ud800\udc62(\ud800\udc63)?)?)?\ud800\udc61\ud800\ud800\udc62\ud800\udc63
82\ud800\udc61\ud800\ud800\udc62\ud800\udc63
83true \ud800\udc61\ud800\ud800\udc62\ud800\udc63 3
84
85^(\ud800\udc61(\ud800\udc02(\ud800\udc63))).*
86\ud800\udc61\ud800\udc02\ud800\udc63
87true \ud800\udc61\ud800\udc02\ud800\udc63 3 \ud800\udc61\ud800\udc02\ud800\udc63 \ud800\udc02\ud800\udc63 \ud800\udc63
88
89^(\ud800\udc61(\ud800(\ud800\udc63))).*
90\ud800\udc61\ud800\ud800\udc63
91true \ud800\udc61\ud800\ud800\udc63 3 \ud800\udc61\ud800\ud800\udc63 \ud800\ud800\udc63 \ud800\udc63
92
93// Patterns including no surrogates
94(.)([^a])xyz
95\ud801\ud800\udc00xyz
96true \ud801\ud800\udc00xyz 2 \ud801 \ud800\udc00
97
98[^a-z]..
99\ud801\ud800\udc00xyz
100true \ud801\ud800\udc00x 0
101
102.$
103\ud801\ud800\udc00
104true \ud800\udc00 0
105
106.$
107\ud801\udc01\ud800\udc00
108true \ud800\udc00 0
109
110.$
111\ud801\udc01\ud800\udc00\udcff
112true \udcff 0
113
114[^x-\uffff][^y-\uffff]
115\ud800\udc00pqr
116true \ud800\udc00p 0
117
118[^x-\uffff]+
119\ud800\udc00pqrx
120true \ud800\udc00pqr 0
121
122/// The following test cases fail due to use of Start rather than
123/// StartS. Disabled for now.
124///[a-\uffff]
125///\ud800\udc00x
126///true x 0
127///
128///[a-\uffff]
129///\ud800\udc00
130///false 0
131
132// unpaired surrogate should match
133[\x{d800}-\x{dbff}\x{dc00}-\x{dfff}]
134xxx\udca9\ud83dyyy
135true \udca9 0
136
137// Android-removed: Unclear why suppl char shouldn't match
138// surrogates in a supplementary character should not match
139// [\x{d800}-\x{dbff}\x{dc00}-\x{dfff}]
140// \ud83d\udca9
141// false 0
142
143// unpaired surrogate should match
144[\p{InHIGH_SURROGATES}\p{InLOW_SURROGATES}]
145xxx\udca9\ud83dyyy
146true \udca9 0
147
148// surrogates part of a supplementary character should not match
149[\p{InHIGH_SURROGATES}\p{InLOW_SURROGATES}]
150\ud83d\udca9
151false 0
152
153// low surrogate part of a supplementary character should not match
154[\x{dc00}-\x{dfff}]
155\ud83d\udca9
156false 0
157
158// use of x modifier
159\ud800\udc61bc(?x)bl\ud800\udc61h
160\ud800\udc61bcbl\ud800\udc61h
161true \ud800\udc61bcbl\ud800\udc61h 0
162
163\ud800\udc61bc(?x)  bl\ud800\udc61h
164\ud800\udc61bcbl\ud800\udc61h
165true \ud800\udc61bcbl\ud800\udc61h 0
166
167\ud800\udc61bc(?x)  bl\ud800\udc61h  blech
168\ud800\udc61bcbl\ud800\udc61hblech
169true \ud800\udc61bcbl\ud800\udc61hblech 0
170
171\ud800\udc61bc(?x)  bl\ud800\udc61h # ignore comment
172\ud800\udc61bcbl\ud800\udc61h
173true \ud800\udc61bcbl\ud800\udc61h 0
174
175// Simple alternation
176\ud800\udc61|\ud800\udc62
177\ud800\udc61
178true \ud800\udc61 0
179
180\ud800\udc61|\ud800\udc62|\ud800
181\ud800\udc61
182true \ud800\udc61 0
183
184\ud800\udc61|\ud800
185\ud800\udc62
186false 0
187
188\ud800\udc62|\ud800
189\ud800
190true \ud800 0
191
192\ud800\udc61|\ud802\udc02
193z
194false 0
195
196\ud800\udc61|\ud802\udc02
197\ud802\udc02
198true \ud802\udc02 0
199
200\ud800\udc61|\ud802\udc02|\ud803\udc03\ud804\udc04
201\ud803\udc03\ud804\udc04
202true \ud803\udc03\ud804\udc04 0
203
204\ud800\udc61|\ud800\udc61d
205\ud800\udc61d
206true \ud800\udc61 0
207
208z(\ud800\udc61|\ud800\udc61c)\ud802\udc02
209z\ud800\udc61c\ud802\udc02
210true z\ud800\udc61c\ud802\udc02 1 \ud800\udc61c
211
212z(\ud800\udc61|\ud800\udc61c|\udc61c)\ud802\udc02
213z\udc61c\ud802\udc02
214true z\udc61c\ud802\udc02 1 \udc61c
215
216// Simple codepoint class
217[\ud800\udc61\ud802\udc02c]+
218\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02
219true \ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02 0
220
221[\ud800\udc61\ud802\udc02c]+
222\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02
223true \ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02 0
224
225[\ud800\udc61\ud802\udc02c\ud800]+
226\ud800\udc61\ud802\udc02\ud800\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02
227true \ud800\udc61\ud802\udc02\ud800\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02 0
228
229[\ud800\udc61bc]+
230d\ud800\udc62fg
231false 0
232
233[\ud800\udc61bc]+[\ud804\udc04ef]+[\ud807\udc07hi]+
234zzz\ud800\udc61\ud800\udc61\ud804\udc04\ud804\udc04\ud807\udc07\ud807\udc07zzz
235true \ud800\udc61\ud800\udc61\ud804\udc04\ud804\udc04\ud807\udc07\ud807\udc07 0
236
237// Range codepoint class
238[\ud801\udc01-\ud807\udc07]+
239\ud8ff\udcff\ud8ff\udcff\ud8ff\udcff\ud807\udc07\ud807\udc07\ud807\udc07
240true \ud807\udc07\ud807\udc07\ud807\udc07 0
241
242[\ud801\udc01-\ud807\udc07]+
243mmm
244false 0
245
246[\ud800\udc61-]+
247z\ud800\udc61-9z
248true \ud800\udc61- 0
249
250// Negated char class
251[^\ud800\udc61\ud802\udc02c]+
252\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02\ud800\udc61\ud802\udc02
253false 0
254
255[^\ud800\udc61\ud802\udc02\ud803\udc03]+
256\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02\ud802\udc02\ud802\udc02\ud803\udc03\ud803\udc03\ud803\udc03\ud804\udc04efg
257true \ud804\udc04efg 0
258
259[^\ud800\udc61\ud802\udc02\ud803\udc03\ud800]+
260\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02\ud802\udc02\ud802\udc02\ud803\udc03\ud803\udc03\ud803\udc03\ud804\udc04efg
261true \ud804\udc04efg 0
262
263// Making sure a ^ not in first position matches literal ^
264[\ud801\udc01\ud802\udc02\ud803\udc03^\ud802\udc02]
265\ud802\udc02
266true \ud802\udc02 0
267
268[\ud801\udc01\ud802\udc02\ud803\udc03^\ud802\udc02]
269^
270true ^ 0
271
272// Class union and intersection
273[\ud801\udc01\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]]
274\ud802\udc02
275true \ud802\udc02 0
276
277[\ud800\udc61\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]]
278\ud805\udc05
279true \ud805\udc05 0
280
281[\ud801\udc01-\ud804\udc04[0-9][\ud80b\udc0b-\ud80d\udc0d]]
282\ud801\udc01
283true \ud801\udc01 0
284
285[\ud801\udc01-\ud804\udc04[0-9][\ud80b\udc0b-\ud80d\udc0d]]
286\ud80c\udc0c
287true \ud80c\udc0c 0
288
289[\ud801\udc01-\ud804\udc04[0-9][\ud80b\udc0b-\ud80d\udc0d]]
2904
291true 4 0
292
293[\ud801\udc01-\ud804\udc04[0-9][\ud80b\udc0b-\ud80d\udc0d]]
294\ud805\udc05
295false 0
296
297[\ud801\udc01-\ud804\udc04[0-9][\ud80b\udc0b-\ud80d\udc0d]]
298\ud816\udc16
299false 0
300
301[[\ud801\udc01-\ud804\udc04][0-9][\ud80b\udc0b-\ud80d\udc0d]]
302\ud802\udc02
303true \ud802\udc02 0
304
305[[\ud801\udc01-\ud804\udc04][0-9][\ud80b\udc0b-\ud80d\udc0d]]
306\ud81a\udc1a
307false 0
308
309[\ud801\udc01-\ud803\udc03[\ud804\udc04-\ud806\udc06[\ud807\udc07-\ud809\udc09]]]
310\ud801\udc01
311true \ud801\udc01 0
312
313[\ud801\udc01-\ud803\udc03[\ud804\udc04-\ud806\udc06[\ud807\udc07-\ud809\udc09]]]
314\ud805\udc05
315true \ud805\udc05 0
316
317[\ud801\udc01-\ud803\udc03[\ud804\udc04-\ud806\udc06[\ud807\udc07-\ud809\udc09]]]
318\ud808\udc08
319true \ud808\udc08 0
320
321[\ud801\udc01-\ud803\udc03[\ud804\udc04-\ud806\udc06[\ud807\udc07-\ud809\udc09]]]
322\ud80d\udc0d
323false 0
324
325[\ud801\udc01-\ud803\udc03[\ud804\udc04-\ud806\udc06[\ud807\udc07-\ud809\udc09]]\ud80d\udc0d]
326\ud80d\udc0d
327true \ud80d\udc0d 0
328
329[\ud801\udc01\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]\ud807\udc07\ud808\udc08\ud809\udc09]
330\ud801\udc01
331true \ud801\udc01 0
332
333[\ud800\udc61\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]\ud807\udc07\ud808\udc08\ud809\udc09]
334\ud804\udc04
335true \ud804\udc04 0
336
337[\ud800\udc61\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]\ud807\udc07\ud808\udc08\ud809\udc09]
338\ud808\udc08
339true \ud808\udc08 0
340
341[\ud800\udc61\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]\ud807\udc07\ud808\udc08\ud809\udc09]
342\ud816\udc16
343false 0
344
345[\ud801\udc01-\ud803\udc03&&[\ud804\udc04-\ud806\udc06]]
346\ud801\udc01
347false 0
348
349[\ud801\udc01-\ud803\udc03&&[\ud804\udc04-\ud806\udc06]]
350\ud805\udc05
351false 0
352
353[\ud801\udc01-\ud803\udc03&&[\ud804\udc04-\ud806\udc06]]
354\ud81a\udc1a
355false 0
356
357[[\ud801\udc01-\ud803\udc03]&&[\ud804\udc04-\ud806\udc06]]
358\ud801\udc01
359false 0
360
361[[\ud801\udc01-\ud803\udc03]&&[\ud804\udc04-\ud806\udc06]]
362\ud805\udc05
363false 0
364
365[[\ud801\udc01-\ud803\udc03]&&[\ud804\udc04-\ud806\udc06]]
366\ud81a\udc1a
367false 0
368
369[\ud801\udc01-\ud803\udc03&&\ud804\udc04-\ud806\udc06]
370\ud801\udc01
371false 0
372
373[\ud801\udc01-\ud80d\udc0d&&\ud80d\udc0d-\ud81a\udc1a]
374\ud80d\udc0d
375true \ud80d\udc0d 0
376
377[\ud801\udc01-\ud80d\udc0d&&\ud80d\udc0d-\ud81a\udc1a&&\ud801\udc01-\ud803\udc03]
378\ud80d\udc0d
379false 0
380
381[\ud801\udc01-\ud80d\udc0d&&\ud80d\udc0d-\ud81a\udc1a&&\ud801\udc01-\ud81a\udc1a]
382\ud80d\udc0d
383true \ud80d\udc0d 0
384
385[[\ud801\udc01-\ud80d\udc0d]&&[\ud80d\udc0d-\ud81a\udc1a]]
386\ud801\udc01
387false 0
388
389[[\ud801\udc01-\ud80d\udc0d]&&[\ud80d\udc0d-\ud81a\udc1a]]
390\ud80d\udc0d
391true \ud80d\udc0d 0
392
393[[\ud801\udc01-\ud80d\udc0d]&&[\ud80d\udc0d-\ud81a\udc1a]]
394\ud81a\udc1a
395false 0
396
397[[\ud801\udc01-\ud80d\udc0d]&&[^\ud801\udc01-\ud803\udc03]]
398\ud801\udc01
399false 0
400
401[[\ud801\udc01-\ud80d\udc0d]&&[^\ud801\udc01-\ud803\udc03]]
402\ud804\udc04
403true \ud804\udc04 0
404
405[\ud801\udc01-\ud80d\udc0d&&[^\ud801\udc01-\ud803\udc03]]
406\ud801\udc01
407false 0
408
409[\ud801\udc01-\ud80d\udc0d&&[^\ud801\udc01-\ud803\udc03]]
410\ud804\udc04
411true \ud804\udc04 0
412
413[\ud801\udc01-\ud803\udc03\ud804\udc04-\ud806\udc06&&[\ud804\udc04-\ud806\udc06]]
414\ud801\udc01
415false 0
416
417[\ud801\udc01-\ud803\udc03\ud804\udc04-\ud806\udc06&&[\ud804\udc04-\ud806\udc06]]
418\ud805\udc05
419true \ud805\udc05 0
420
421[[\ud801\udc01-\ud803\udc03]&&\ud804\udc04-\ud806\udc06\ud801\udc01-\ud803\udc03]
422\ud801\udc01
423true \ud801\udc01 0
424
425[[\ud801\udc01-\ud803\udc03]&&[\ud804\udc04-\ud806\udc06][\ud801\udc01-\ud803\udc03]]
426\ud801\udc01
427true \ud801\udc01 0
428
429[[\ud801\udc01-\ud803\udc03][\ud804\udc04-\ud806\udc06]&&\ud801\udc01\ud802\udc02\ud803\udc03]
430\ud801\udc01
431true \ud801\udc01 0
432
433[[\ud801\udc01-\ud803\udc03][\ud804\udc04-\ud806\udc06]&&\ud801\udc01\ud802\udc02\ud803\udc03[\ud804\udc04\ud805\udc05\ud806\udc06]]
434\ud805\udc05
435true \ud805\udc05 0
436
437[[\ud801\udc01-\ud803\udc03]&&[\ud802\udc02-\ud804\udc04]&&[\ud803\udc03-\ud805\udc05]]
438\ud801\udc01
439false 0
440
441[[\ud801\udc01-\ud803\udc03]&&[\ud802\udc02-\ud804\udc04]&&[\ud803\udc03-\ud805\udc05]]
442\ud803\udc03
443true \ud803\udc03 0
444
445[[\ud801\udc01-\ud803\udc03]&&[\ud802\udc02-\ud804\udc04][\ud803\udc03-\ud805\udc05]&&[\ud815\udc15-\ud81a\udc1a]]
446\ud803\udc03
447false 0
448
449[\ud801\udc01\ud802\udc02\ud803\udc03[^\ud802\udc02\ud803\udc03\ud804\udc04]]
450\ud801\udc01
451true \ud801\udc01 0
452
453[\ud800\udc61\ud802\udc02\ud803\udc03[^\ud802\udc02\ud803\udc03\ud804\udc04]]
454\ud804\udc04
455false 0
456
457[\ud801\udc01-\ud803\udc03&&\ud801\udc01-\ud804\udc04&&\ud801\udc01-\ud805\udc05\ud807\udc07\ud808\udc08\ud809\udc09]
458\ud802\udc02
459true \ud802\udc02 0
460
461[\ud801\udc01-\ud803\udc03&&\ud801\udc01-\ud804\udc04&&\ud801\udc01-\ud805\udc05\ud807\udc07\ud808\udc08\ud809\udc09]
462\ud807\udc07
463false 0
464
465[[\ud801\udc01[\ud802\udc02]]&&[\ud802\udc02[\ud801\udc01]]]
466\ud801\udc01
467true \ud801\udc01 0
468
469// Unicode isn't supported in clazz()
470[[\ud800\udc61]&&[b][c][\ud800\udc61]&&[^d]]
471\ud800\udc61
472true \ud800\udc61 0
473
474[[\ud800\udc61]&&[\ud802\udc02][\ud800][\ud800\udc61]&&[^\ud804\udc04]]
475\ud800\udc61
476true \ud800\udc61 0
477
478[[\ud800\udc61]&&[b][\ud800][\ud800\udc61]&&[^\ud804\udc04]]
479\ud804\udc04
480false 0
481
482[[\ud800\udc61]&&[b][c][\ud800\udc61]&&[^d]]
483d
484false 0
485
486[[[\ud800\udc01-\ud800\udc04]&&[\ud800\udc03-\ud800\udc06]]]
487\ud800\udc01
488false 0
489
490[[[\ud800\udc01-\ud800\udc04]&&[\ud800\udc03-\ud800\udc06]]]
491\ud800\udc03
492true \ud800\udc03 0
493
494[[[\ud800\udc01-\ud800\udc04]&&[\ud800\udc03-\ud800\udc06]]&&[\ud800\udc03]]
495\ud800\udc03
496true \ud800\udc03 0
497
498[[[\ud800\udc01-\ud800\udc04]&&[\ud800\udc03-\ud800\udc06]]&&[\ud800\udc03]&&\ud800\udc03]
499\ud800\udc03
500true \ud800\udc03 0
501
502[[[\ud800\udc01-\ud800\udc04]&&[\ud800\udc03-\ud800\udc06]]&&[\ud800\udc03]&&\ud800\udc03&&\ud800\udc03]
503\ud800\udc03
504true \ud800\udc03 0
505
506[[[\ud800\udc01-\ud800\udc04]&&[\ud800\udc03-\ud800\udc06]]&&[\ud800\udc03]&&\ud800\udc03&&[\ud800\udc03\ud800\udc04\ud800\udc05]]
507\ud800\udc03
508true \ud800\udc03 0
509
510[z[\ud800\udc61b\ud800\udc03&&b\ud800\udc03\ud800\udc04]]
511\ud800\udc03
512true \ud800\udc03 0
513
514[z[\ud800\udc61b\ud800\udc03&&b\ud800\udc03\ud800\udc04]&&[u-z]]
515z
516true z 0
517
518[x[\ud800\udc61b\ud800\udc03&&b\ud800\udc03\ud800\udc04[z]]&&[u-z]]
519z
520false 0
521
522[x[[wz]\ud800\udc61b\ud800\udc03&&b\ud800\udc03\ud800\udc04[z]]&&[u-z]]
523z
524true z 0
525
526[[\ud800\udc61b\ud800\udc03]&&[\ud800\udc04\ud800\udc05f]\ud800\udc61b\ud800\udc03]
527\ud800\udc61
528true \ud800\udc61 0
529
530[[\ud800\udc61b\ud800\udc03]&&[\ud800\udc04\ud800\udc05f]xyz[\ud800\udc61b\ud800\udc03]]
531\ud800\udc61
532true \ud800\udc61 0
533
534// Android-changed: \pL isn't a known documented syntax.
535// \pL
536\p{L}
537\ud800\udc00
538true \ud800\udc00 0
539
540\p{IsASCII}
541\ud800\udc00
542false 0
543
544// Android-changed: \pL isn't a known documented syntax.
545// \pLbc
546\p{L}bc
547\ud800\udc00bc
548true \ud800\udc00bc 0
549
550\ud800\udc61[r\p{InGreek}]c
551\ud800\udc61\u0370c
552true \ud800\udc61\u0370c 0
553
554\ud800\udc61\p{InGreek}
555\ud800\udc61\u0370
556true \ud800\udc61\u0370 0
557
558\ud800\udc61\P{InGreek}
559\ud800\udc61\u0370
560false 0
561
562\ud800\udc61\P{InGreek}
563\ud800\udc61b
564true \ud800\udc61b 0
565
566\ud800\udc61{^InGreek}
567-
568error
569
570\ud800\udc61\p{^InGreek}
571-
572error
573
574\ud800\udc61\P{^InGreek}
575-
576error
577
578\ud800\udc61\p{InGreek}
579\ud800\udc61\u0370
580true \ud800\udc61\u0370 0
581
582\ud800\udc61[\p{InGreek}]c
583\ud800\udc61\u0370c
584true \ud800\udc61\u0370c 0
585
586\ud800\udc61[\P{InGreek}]c
587\ud800\udc61\u0370c
588false 0
589
590\ud800\udc61[\P{InGreek}]c
591\ud800\udc61bc
592true \ud800\udc61bc 0
593
594\ud800\udc61[{^InGreek}]c
595\ud800\udc61nc
596true \ud800\udc61nc 0
597
598\ud800\udc61[{^InGreek}]c
599\ud800\udc61zc
600false 0
601
602\ud800\udc61[\p{^InGreek}]c
603-
604error
605
606\ud800\udc61[\P{^InGreek}]c
607-
608error
609
610\ud800\udc61[\p{InGreek}]
611\ud800\udc61\u0370
612true \ud800\udc61\u0370 0
613
614\ud800\udc61[r\p{InGreek}]c
615\ud800\udc61rc
616true \ud800\udc61rc 0
617
618\ud800\udc61[\p{InGreek}r]c
619\ud800\udc61rc
620true \ud800\udc61rc 0
621
622\ud800\udc61[r\p{InGreek}]c
623\ud800\udc61rc
624true \ud800\udc61rc 0
625
626\ud800\udc61[^\p{InGreek}]c
627\ud800\udc61\u0370c
628false 0
629
630\ud800\udc61[^\P{InGreek}]c
631\ud800\udc61\u0370c
632true \ud800\udc61\u0370c 0
633
634\ud800\udc61[\p{InGreek}&&[^\u0370]]c
635\ud800\udc61\u0370c
636false 0
637
638// Test the dot metacharacter
639\ud800\udc61.c.+
640\ud800\udc61#c%&
641true \ud800\udc61#c%& 0
642
643\ud800\udc61b.
644\ud800\udc61b\n
645false 0
646
647(?s)\ud800\udc61b.
648\ud800\udc61b\n
649true \ud800\udc61b\n 0
650
651\ud800\udc61[\p{L}&&[\P{InGreek}]]c
652\ud800\udc61\u6000c
653true \ud800\udc61\u6000c 0
654
655\ud800\udc61[\p{L}&&[\P{InGreek}]]c
656\ud800\udc61rc
657true \ud800\udc61rc 0
658
659\ud800\udc61[\p{L}&&[\P{InGreek}]]c
660\ud800\udc61\u0370c
661false 0
662
663\ud800\udc61\p{InGreek}c
664\ud800\udc61\u0370c
665true \ud800\udc61\u0370c 0
666
667\ud800\udc61\p{Sc}
668\ud800\udc61$
669true \ud800\udc61$ 0
670
671// Test \p{L}
672\p{L}
673\ud800\udf1e
674true \ud800\udf1e 0
675
676^a\p{L}z$
677a\ud800\udf1ez
678true a\ud800\udf1ez 0
679
680// Test \P{InDeseret}
681
682\ud800\udf00\p{L}{2,3}\P{L}*supp->\ud900\udc00<-\P{InDeseret}
683\ud800\udf00\ud800\udf1e\ud800\udf1esupp->\ud900\udc00<-\ud901\udf00
684true \ud800\udf00\ud800\udf1e\ud800\udf1esupp->\ud900\udc00<-\ud901\udf00 0
685
686\ud800\udf00\p{L}{2,3}\P{L}*supp->\ud900\udc00<-\P{InDeseret}
687\ud800\udf00\ud800\udf1e\ud800\udf1e\ud901\udf00supp->\ud900\udc00<-\ud901\udf00
688true \ud800\udf00\ud800\udf1e\ud800\udf1e\ud901\udf00supp->\ud900\udc00<-\ud901\udf00 0
689
690// Test \p{InDeseret}
691\ud800\udf00\p{L}{2,3}\P{L}*supp->\ud900\udc00<-\p{InDeseret}
692\ud800\udf00\ud800\udf1e\ud800\udf1e\ud901\udf00supp->\ud900\udc00<-\ud801\udc00
693true \ud800\udf00\ud800\udf1e\ud800\udf1e\ud901\udf00supp->\ud900\udc00<-\ud801\udc00 0
694
695// Test the word char escape sequence
696\ud800\udc61b\wc
697\ud800\udc61bcc
698true \ud800\udc61bcc 0
699
700\ud800\udc61bc[\w]
701\ud800\udc61bcd
702true \ud800\udc61bcd 0
703
704\ud800\udc61bc[\sdef]*
705\ud800\udc61bc  def
706true \ud800\udc61bc  def 0
707
708\ud800\udc61bc[\sy-z]*
709\ud800\udc61bc y z
710true \ud800\udc61bc y z 0
711
712\ud800\udc01bc[\ud800\udc01-\ud800\udc04\sm-p]*
713\ud800\udc01bc\ud800\udc01\ud800\udc01 mn  p
714true \ud800\udc01bc\ud800\udc01\ud800\udc01 mn  p 0
715
716// Test the whitespace escape sequence
717\ud800\udc61b\s\ud800\udc03
718\ud800\udc61b \ud800\udc03
719true \ud800\udc61b \ud800\udc03 0
720
721\s\s\s
722bl\ud800\udc61h  err
723false 0
724
725\S\S\s
726bl\ud800\udc61h  err
727true \ud800\udc61h  0
728
729// Test the digit escape sequence
730\ud800\udc61b\d\ud800\udc03
731\ud800\udc61b9\ud800\udc03
732true \ud800\udc61b9\ud800\udc03 0
733
734\d\d\d
735bl\ud800\udc61h45
736false 0
737
738// Test the caret metacharacter
739^\ud800\udc61bc
740\ud800\udc61bcdef
741true \ud800\udc61bc 0
742
743^\ud800\udc61bc
744bcd\ud800\udc61bc
745false 0
746
747// Greedy ? metacharacter
748\ud800\udc61?\ud800\udc02
749\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
750true \ud800\udc61\ud800\udc02 0
751
752\udc61?\ud800\udc02
753\ud800\udc61\udc61\udc61\ud800\udc02
754true \udc61\ud800\udc02 0
755
756\ud800\udc61?\ud800\udc02
757\ud800\udc02
758true \ud800\udc02 0
759
760\ud800?\ud800\udc02
761\ud800\udc02
762true \ud800\udc02 0
763
764\ud800\udc61?\ud800\udc02
765\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc03\ud800\udc03\ud800\udc03
766false 0
767
768.?\ud800\udc02
769\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
770true \ud800\udc61\ud800\udc02 0
771
772// Reluctant ? metacharacter
773\ud800\udc61??\ud800\udc02
774\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
775true \ud800\udc61\ud800\udc02 0
776
777\ud800??\ud800\udc02
778\ud800\ud800\ud8001\ud800\ud800\udc02
779true \ud800\ud800\udc02 0
780
781\ud800\udc61??\ud800\udc02
782\ud800\udc02
783true \ud800\udc02 0
784
785\ud800??\ud800\udc02
786\ud800\udc02
787true \ud800\udc02 0
788
789\ud800\udc61??\ud800\udc02
790\ud800\udc61\ud800\udc61\ud800\udc61ccc
791false 0
792
793.??\ud800\udc02
794\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
795true \ud800\udc61\ud800\udc02 0
796
797// Possessive ? metacharacter
798\ud800\udc61?+\ud800\udc02
799\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
800true \ud800\udc61\ud800\udc02 0
801
802\ud800\udc61?+\ud800\udc02
803\ud800\udc02
804true \ud800\udc02 0
805
806\ud800\udc61?+\ud800\udc02
807\ud800\udc61\ud800\udc61\ud800\udc61ccc
808false 0
809
810.?+\ud800\udc02
811\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
812true \ud800\udc61\ud800\udc02 0
813
814// Greedy + metacharacter
815\ud800\udc61+\ud800\udc02
816\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
817true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02 0
818
819\udc61+\ud800\udc02
820\ud800\udc61\udc61\udc61\udc61\ud800\udc02
821true \udc61\udc61\udc61\ud800\udc02 0
822
823\ud800\udc61+\ud800\udc02
824\ud800\udc02
825false 0
826
827\ud800+\ud800\udc02
828\ud800\udc02
829false 0
830
831\ud800\udc61+\ud800\udc02
832\ud800\udc61\ud800\udc61\ud800\udc61ccc
833false 0
834
835.+\ud800\udc02
836\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
837true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02 0
838
839.+\ud800\udc02
840\ud800\udc61\udc61\udc61\udc61\ud800\udc02
841true \ud800\udc61\udc61\udc61\udc61\ud800\udc02 0
842
843// Reluctant + metacharacter
844\ud800\udc61+?\ud800\udc02
845\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
846true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02 0
847
848\udc61+?\ud800\udc02
849\udc61\udc61\udc61\udc61\ud800\udc02
850true \udc61\udc61\udc61\udc61\ud800\udc02 0
851
852\ud800\udc61+?\ud800\udc02
853\ud800\udc02
854false 0
855
856\ud800+?\ud800\udc02
857\ud800\udc02
858false 0
859
860\ud800\udc61+?\ud800\udc02
861\ud800\udc61\ud800\udc61\ud800\udc61ccc
862false 0
863
864.+?\ud800\udc02
865\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
866true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02 0
867
868// Possessive + metacharacter
869\ud800\udc61++\ud800\udc02
870\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
871true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02 0
872
873\ud800\udc61++\ud800\udc02
874\ud800\udc02
875false 0
876
877\ud800\udc61++\ud800\udc02
878\ud800\udc61\ud800\udc61\ud800\udc61ccc
879false 0
880
881.++\ud800\udc02
882\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc02
883false 0
884
885// Greedy Repetition
886\ud800\udc61{2,3}
887\ud800\udc61
888false 0
889
890\ud800\udc61{2,3}
891\ud800\udc61\ud800\udc61
892true \ud800\udc61\ud800\udc61 0
893
894\ud800\udc61{2,3}
895\ud800\udc61\ud800\udc61\ud800\udc61
896true \ud800\udc61\ud800\udc61\ud800\udc61 0
897
898\ud800\udc61{2,3}
899\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61
900true \ud800\udc61\ud800\udc61\ud800\udc61 0
901
902\ud800\udc61{3,}
903zzz\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61zzz
904true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61 0
905
906\ud800\udc61{3,}
907zzz\ud800\udc61\ud800\udc61zzz
908false 0
909
910// Reluctant Repetition
911\ud800\udc61{2,3}?
912\ud800\udc61
913false 0
914
915\ud800\udc61{2,3}?
916\ud800\udc61\ud800\udc61
917true \ud800\udc61\ud800\udc61 0
918
919\ud800\udc61{2,3}?
920\ud800\udc61\ud800\udc61\ud800\udc61
921true \ud800\udc61\ud800\udc61 0
922
923\ud800\udc61{2,3}?
924\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61
925true \ud800\udc61\ud800\udc61 0
926
927// Zero width Positive lookahead
928\ud800\udc61\ud802\udc02\ud803\udc03(?=\ud804\udc04)
929zzz\ud800\udc61\ud802\udc02\ud803\udc03\ud804\udc04
930true \ud800\udc61\ud802\udc02\ud803\udc03 0
931
932\ud800\udc61\ud802\udc02\ud803\udc03(?=\ud804\udc04)
933zzz\ud800\udc61\ud802\udc02\ud803\udc03e\ud804\udc04
934false 0
935
936\ud800\udc61\ud802\udc02\ud803\udc03(?=\udcff\ud804\udc04)
937zzz\ud800\udc61\ud802\udc02\ud803\udc03\udcff\ud804\udc04
938true \ud800\udc61\ud802\udc02\ud803\udc03 0
939
940\ud800\udc61\ud802\udc02\ud803\udc03(?=\udcff\ud804\udc04)
941zzz\ud800\udc61\ud802\udc02\ud803\udc03\ud8ff\udcff\ud804\udc04
942false 0
943
944// Zero width Negative lookahead
945\ud800\udc61\ud802\udc02\ud803\udc03(?!\ud804\udc04)
946zz\ud800\udc61\ud802\udc02\ud803\udc03\ud804\udc04
947false 0
948
949a\ud802\udc02\ud803\udc03(?!\ud804\udc04)
950zza\ud802\udc02\ud803\udc03\udc04\ud804\udc04
951true a\ud802\udc02\ud803\udc03 0
952
953\ud800\udc61\ud802\udc02\ud803\udc03(?!\ud804\udc04\ud8ff)
954zz\ud800\udc61\ud802\udc02\ud803\udc03\ud804\udc04\ud8ffX
955false 0
956
957a\ud802\udc02\ud803\udc03(?!\ud804\udc04\ud8ff)
958zza\ud802\udc02\ud803\udc03e\ud804\udc04\ud8ff\udcff
959true a\ud802\udc02\ud803\udc03 0
960
961// Zero width Positive lookbehind
962(?<=\ud801\udc01\ud802\udc02)\ud803\udc03
963\ud801\udc01\ud802\udc02\ud803\udc03
964true \ud803\udc03 0
965
966// Zero width Negative lookbehind
967(?<!\ud801\udc01)\ud802\udc02\ud803\udc03
968###\ud800\udc00\ud802\udc02\ud803\udc03
969true \ud802\udc02\ud803\udc03 0
970
971(?<![\ud801\udc01\ud802\udc02])\ud803\udc03.
972\ud801\udc01\ud803\udc03x\ud800\udc00\ud803\udc03y
973true \ud803\udc03y 0
974
975(?<!\ud801\udc01)\ud803\udc03
976\ud801\udc01\ud803\udc03
977false 0
978
979// Nondeterministic group
980(\ud800\udc61+\ud802)+
981\ud800\udc61\ud802\ud800\udc61\ud802\ud800\udc61\ud802
982true \ud800\udc61\ud802\ud800\udc61\ud802\ud800\udc61\ud802 1 \ud800\udc61\ud802
983
984(\ud800\udc61|\ud802)+
985\ud800\ud802\udc61\ud803\ud802\udc61
986false 1
987
988// Deterministic group
989(\ud800\udc61\ud802)+
990\ud800\udc61\ud802\ud800\udc61\ud802\ud800\udc61\ud802
991true \ud800\udc61\ud802\ud800\udc61\ud802\ud800\udc61\ud802 1 \ud800\udc61\ud802
992
993(\ud800\udc61\ud802)+
994\ud800\udc61ccccd
995false 1
996
997(\ud800\udc61\ud802)*
998\ud800\udc61\ud802\ud800\udc61\ud802\ud800\udc61\ud802
999true \ud800\udc61\ud802\ud800\udc61\ud802\ud800\udc61\ud802 1 \ud800\udc61\ud802
1000
1001(\ud800\udc61b)(cd*)
1002zzz\ud800\udc61bczzz
1003true \ud800\udc61bc 2 \ud800\udc61b c
1004
1005\ud800\udc61bc(\ud804\udc04)*\ud800\udc61bc
1006\ud800\udc61bc\ud804\udc04\ud804\udc04\ud804\udc04\ud804\udc04\ud804\udc04\ud800\udc61bc
1007true \ud800\udc61bc\ud804\udc04\ud804\udc04\ud804\udc04\ud804\udc04\ud804\udc04\ud800\udc61bc 1 \ud804\udc04
1008
1009// Back references
1010(\ud800\udc61*)\ud802\udc02c\1
1011zzz\ud800\udc61\ud800\udc61\ud802\udc02c\ud800\udc61\ud800\udc61zzz
1012true \ud800\udc61\ud800\udc61\ud802\udc02c\ud800\udc61\ud800\udc61 1 \ud800\udc61\ud800\udc61
1013
1014(\ud800\udc61*)\ud802\udc02c\1
1015zzz\ud800\udc61\ud800\udc61\ud802\udc02c\ud800\udc61zzz
1016true \ud800\udc61\ud802\udc02c\ud800\udc61 1 \ud800\udc61
1017
1018(\ud800\udc07\ud800\udc14*)(\ud804\udc04\ud804\udc04e)*(yu)\1\3(vv)
1019zzz\ud800\udc07\ud800\udc14\ud800\udc14\ud804\udc04\ud804\udc04e\ud804\udc04\ud804\udc04eyu\ud800\udc07\ud800\udc14\ud800\udc14yuvvzzz
1020true \ud800\udc07\ud800\udc14\ud800\udc14\ud804\udc04\ud804\udc04e\ud804\udc04\ud804\udc04eyu\ud800\udc07\ud800\udc14\ud800\udc14yuvv 4 \ud800\udc07\ud800\udc14\ud800\udc14 \ud804\udc04\ud804\udc04e yu vv
1021
1022// Greedy * metacharacter
1023\ud800\udc61*\ud802\udc02
1024\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02
1025true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02 0
1026
1027\ud800\udc61*\ud802\udc02
1028\ud802\udc02
1029true \ud802\udc02 0
1030
1031\ud800\udc61*\ud802\udc02
1032\ud800\udc61\ud800\udc61\ud800\udc61ccc
1033false 0
1034
1035.*\ud802\udc02
1036\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02
1037true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02 0
1038
1039// Reluctant * metacharacter
1040\ud800\udc61*?\ud802\udc02
1041\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02
1042true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02 0
1043
1044\ud800\udc61*?\ud802\udc02
1045\ud802\udc02
1046true \ud802\udc02 0
1047
1048\ud800\udc61*?\ud802\udc02
1049\ud800\udc61\ud800\udc61\ud800\udc61ccc
1050false 0
1051
1052.*?\ud802\udc02
1053\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02
1054true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02 0
1055
1056// Possessive * metacharacter
1057\ud800\udc61*+\ud802\udc02
1058\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02
1059true \ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02 0
1060
1061\ud800\udc61*+\ud802\udc02
1062\ud802\udc02
1063true \ud802\udc02 0
1064
1065\ud800\udc61*+\ud802\udc02
1066\ud800\udc61\ud800\udc61\ud800\udc61ccc
1067false 0
1068
1069.*+\ud802\udc02
1070\ud800\udc61\ud800\udc61\ud800\udc61\ud800\udc61\ud802\udc02
1071false 0
1072
1073// Case insensitivity
1074(?iu)\ud801\udc00\ud801\udc01\ud801\udc02x
1075\ud801\udc28\ud801\udc29\ud801\udc2aX
1076true \ud801\udc28\ud801\udc29\ud801\udc2aX 0
1077
1078\ud801\udc00(?iu)\ud801\udc01\ud801\udc02
1079\ud801\udc00\ud801\udc29\ud801\udc2a
1080true \ud801\udc00\ud801\udc29\ud801\udc2a 0
1081
1082\ud801\udc00(?iu)\ud801\udc01\ud801\udc02
1083\ud801\udc28\ud801\udc29\ud801\udc2a
1084false 0
1085
1086(?iu)\ud801\udc00[\ud801\udc01\ud801\udc02]+
1087\ud801\udc28\ud801\udc29\ud801\udc2a
1088true \ud801\udc28\ud801\udc29\ud801\udc2a 0
1089
1090(?iu)[\ud801\udc00-\ud801\udc02]+
1091\ud801\udc28\ud801\udc29\ud801\udc2a
1092true \ud801\udc28\ud801\udc29\ud801\udc2a 0
1093
1094// Disable metacharacters- test both length <=3 and >3
1095// So that the BM optimization is part of test
1096\Q***\E\ud801\udc01\ud802\udc02\ud800\udc03
1097***\ud801\udc01\ud802\udc02\ud800\udc03
1098true ***\ud801\udc01\ud802\udc02\ud800\udc03 0
1099
1100\ud802\udc02l\Q***\E\ud801\udc01\ud802\udc02\ud800\udc03
1101\ud802\udc02l***\ud801\udc01\ud802\udc02\ud800\udc03
1102true \ud802\udc02l***\ud801\udc01\ud802\udc02\ud800\udc03 0
1103
1104\Q***\ud801\udc01\ud802\udc02\ud800\udc03
1105***\ud801\udc01\ud802\udc02\ud800\udc03
1106true ***\ud801\udc01\ud802\udc02\ud800\udc03 0
1107
1108\ud802\udc02l\ud801\udc01h\Q***\E\ud801\udc01\ud802\udc02\ud800\udc03
1109\ud802\udc02l\ud801\udc01h***\ud801\udc01\ud802\udc02\ud800\udc03
1110true \ud802\udc02l\ud801\udc01h***\ud801\udc01\ud802\udc02\ud800\udc03 0
1111
1112\Q***\ud801\udc01\ud802\udc02\ud800\udc03
1113***\ud801\udc01\ud802\udc02\ud800\udc03
1114true ***\ud801\udc01\ud802\udc02\ud800\udc03 0
1115
1116\Q*\ud801\udc01\ud802\udc02
1117*\ud801\udc01\ud802\udc02
1118true *\ud801\udc01\ud802\udc02 0
1119
1120\ud802\udc02l\ud801\udc01h\Q***\ud801\udc01\ud802\udc02\ud800\udc03
1121\ud802\udc02l\ud801\udc01h***\ud801\udc01\ud802\udc02\ud800\udc03
1122true \ud802\udc02l\ud801\udc01h***\ud801\udc01\ud802\udc02\ud800\udc03 0
1123
1124\ud802\udc02l\ud801\udc01\Q***\ud801\udc01\ud802\udc02\ud800\udc03
1125\ud802\udc02l\ud801\udc01***\ud801\udc01\ud802\udc02\ud800\udc03
1126true \ud802\udc02l\ud801\udc01***\ud801\udc01\ud802\udc02\ud800\udc03 0
1127
1128//Test cases below copied from i18n QE's RegexSupplementaryTests.txt
1129\uD800\uDFFF\uD801\uDFF1\uDB00\uDC00
1130\uD800\uDFFF\uD801\uDFF1\uDB00\uDC00
1131true \uD800\uDFFF\uD801\uDFF1\uDB00\uDC00 0
1132
1133\uD800\uDFFF\uD801\uDFF1\uDB00\uDC00
1134\u1000\uD801\uDFF1\uDB00\uDC00
1135false 0
1136
1137\uD800\uDFFF\uD801\uDFF1\uDB00\uDC00
1138\uD800\uDFFF\uFFFF\uDB00\uDC00
1139false 0
1140
1141\uD800\uDFFF\uD801\uDFF1\uDB00\uDC00
1142\uD800\uDFFF\uD801\uDFF1\uFFFF
1143false 0
1144
1145\u1000.\uFFFF
1146\u1000\uD800\uDFFF\uFFFF
1147true \u1000\uD800\uDFFF\uFFFF 0
1148
1149//=======
1150// Ranges
1151//=======
1152[a-\uD800\uDFFF]
1153\uDFFF
1154true \uDFFF 0
1155
1156[a-\uD800\uDFFF]
1157\uD800
1158true \uD800 0
1159
1160[a-\uD800\uDFFF]
1161\uD800\uDFFF
1162true \uD800\uDFFF 0
1163
1164[\uD800\uDC00-\uDBFF\uDFFF]
1165\uDBFF
1166false 0
1167
1168[\uD800\uDC00-\uDBFF\uDFFF]
1169\uDC00
1170false 0
1171
1172[\uD800-\uDFFF]
1173\uD800\uDFFF
1174false 0
1175
1176[\uD800-\uDFFF]
1177\uDFFF\uD800
1178true \uDFFF 0
1179
1180foo[^\uD800-\uDFFF]
1181foo\uD800\uDFFF
1182true foo\uD800\uDFFF 0
1183
1184foo[^\uD800-\uDFFF]
1185foo\uDFFF\uD800
1186false 0
1187
1188//fo\uD800[\uDC00-\uDFFF]
1189
1190//==================
1191// Character Classes
1192//==================
1193// Simple class
1194[ab\uD800\uDFFFcd]at
1195\uD800at
1196false 0
1197
1198[ab\uD800\uDFFFcd]at
1199\uD800\uDFFFat
1200true \uD800\uDFFFat 0
1201
1202// Negation
1203[^\uD800\uDFFFcd]at
1204\uD800at
1205true \uD800at 0
1206
1207[^\uD800\uDFFFcd]at
1208\uDFFFat
1209true \uDFFFat 0
1210
1211// Inclusive range
1212[\u0000-\uD800\uDFFF-\uFFFF]
1213\uD800\uDFFF
1214true \uD800\uDFFF 0
1215
1216// Unions
1217[\u0000-\uD800[\uDFFF-\uFFFF]]
1218\uD800\uDFFF
1219false 0
1220
1221
1222// Intersection
1223[\u0000-\uFFFF&&[\uD800\uDFFF]]
1224\uD800\uDFFF
1225false 0
1226
1227[\u0000-\uFFFF&&[\uD800\uDFFF]]
1228\uD800
1229false 0
1230
1231[\u0000-\uFFFF&&[\uDFFF\uD800]]
1232\uD800
1233true \uD800 0
1234
1235[\u0000-\uFFFF&&[\uDFFF\uD800\uDC00]]
1236\uDC00
1237false 0
1238
1239[\u0000-\uDFFF&&[\uD800-\uFFFF]]
1240\uD800\uDFFF
1241false 0
1242
1243[\u0000-\uDFFF&&[\uD800-\uFFFF]]
1244\uDFFF\uD800
1245true \uDFFF 0
1246
1247// Subtraction
1248[\u0000-\uD800\uDFFF&&[^\uD800\uDC00]]
1249\uD800
1250true \uD800 0
1251
1252[\u0000-\uD800\uDFFF&&[^\uD800\uDC00]]
1253\uDC00
1254true \uDC00 0
1255
1256[\u0000-\uD800\uDFFF&&[^\uD800\uDC00]]
1257\uD800\uDFFF
1258true \uD800\uDFFF 0
1259
1260[\u0000-\uD800\uDFFF&&[^\uD800\uDBFF\uDC00]]
1261\uD800
1262false 0
1263
1264[\u0000-\uD800\uDFFF&&[^\uDC00\uD800\uDBFF]]
1265\uD800\uDC00
1266true \uD800\uDC00 0
1267
1268// Quantifiers
1269a\uD800\uDFFF?
1270a\uD800
1271true a 0
1272
1273a\uD800\uDFFF?
1274a\uDFFF
1275true a 0
1276
1277a\uD800\uDFFF?
1278a\uD800\uDFFF
1279true a\uD800\uDFFF 0
1280
1281a\uDFFF\uD800?
1282a\uDFFF
1283true a\uDFFF 0
1284
1285a\uDFFF\uD800?
1286a\uD800
1287false 0
1288
1289\uD800\uDFFF\uDC00?
1290\uD800
1291false 0
1292
1293\uD800\uDFFF\uDC00?
1294\uD800\uDFFF
1295true \uD800\uDFFF 0
1296
1297a\uD800\uDFFF??
1298a\uDFFF
1299true a 0
1300
1301a\uD800\uDFFF*
1302a
1303true a 0
1304
1305a\uD800\uDFFF*
1306a\uD800
1307true a 0
1308
1309\uD800\uDFFF*
1310\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF
1311true \uD800\uDFFF\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF 0
1312
1313\uD800\uDFFF*
1314\uD800\uDFFF\uDFFF\uDFFF\uDFFF
1315true \uD800\uDFFF 0
1316
1317\uD800*\uDFFF
1318\uD800\uDFFF
1319false 0
1320
1321a\uD800\uDFFF*
1322a\uD800
1323true a 0
1324
1325\uDFFF\uD800*
1326\uDFFF
1327true \uDFFF 0
1328
1329\uDFFF\uD800*
1330\uDFFF\uD800\uD800\uD800
1331true \uDFFF\uD800\uD800\uD800 0
1332
1333\uD800\uDFFF+
1334\uD800\uDFFF\uDFFF\uDFFF
1335true \uD800\uDFFF 0
1336
1337\uD800\uDFFF+
1338\uD800
1339false 0
1340
1341\uD800\uDFFF+
1342\uD800\uDFFF
1343true \uD800\uDFFF 0
1344
1345\uD800\uDFFF+
1346\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF
1347true \uD800\uDFFF\uD800\uDFFF\uD800\uDFFF 0
1348
1349\uDFFF\uD800+
1350\uDFFF\uD800\uDFFF\uD800
1351false 0
1352
1353\uD800+\uDFFF
1354\uD800\uDFFF
1355false 0
1356
1357\uD800+\uDFFF
1358\uD800
1359false 0
1360
1361\uDFFF+\uD800
1362\uD800
1363false 0
1364
1365\uDFFF+\uD800
1366\uDFFF\uD800
1367true \uDFFF\uD800 0
1368
1369\uD800\uDFFF{3}
1370\uD800\uDFFF\uDFFF\uDFFF
1371false 0
1372
1373\uD800\uDFFF{3}
1374\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF
1375true \uD800\uDFFF\uD800\uDFFF\uD800\uDFFF 0
1376
1377\uDFFF\uD800{3}
1378\uDFFF\uD800\uDFFF\uD800\uDFFF\uD800
1379false 0
1380
1381\uDFFF\uD800{3}
1382\uDFFF\uD800\uD800\uD800
1383true \uDFFF\uD800\uD800\uD800 0
1384
1385\uD800\uDFFF{2,}
1386\uD800\uDFFF
1387false 0
1388
1389\uD800\uDFFF{2,}
1390\uD800\uDFFF\uDFFF
1391false 0
1392
1393\uD800\uDFFF{2,}
1394\uD800\uDFFF\uD800\uDFFF
1395true \uD800\uDFFF\uD800\uDFFF 0
1396
1397\uDFFF\uD800{2,}
1398\uDFFF\uD800\uDFFF\uD800
1399false 0
1400
1401\uDFFF\uD800{2,}
1402\uDFFF\uD800\uD800\uD800
1403true \uDFFF\uD800\uD800\uD800 0
1404
1405\uD800\uDFFF{3,4}
1406\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF
1407true \uD800\uDFFF\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF 0
1408
1409\uD800\uDFFF{3,4}
1410\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF\uD800
1411true \uD800\uDFFF\uD800\uDFFF\uD800\uDFFF 0
1412
1413\uD800\uDFFF{3,4}
1414\uD800\uDFFF\uD800\uD800\uDFFF\uD800\uDFFF
1415false 0
1416
1417\uDFFF\uD800{3,5}
1418\uDFFF\uD800\uD800\uD800\uD800\uD800\uD800\uD800
1419true \uDFFF\uD800\uD800\uD800\uD800\uD800 0
1420
1421\uD800\uDFFF{3,5}
1422\uD800\uDFFF\uDFFF\uDFFF
1423false 0
1424
1425\uD800\uDFFF{3,5}
1426\uD800\uDFFF\uD800\uD800\uDFFF\uD800\uDFFF\uD800\uDFFF
1427true \uD800\uDFFF\uD800\uDFFF\uD800\uDFFF 0
1428
1429// Groupings
1430(\uD800(\uDFFF))
1431\uD800\uDFFF
1432false 2
1433
1434(\uD800(\uDC00)(\uDFFF))
1435\uD800\uDC00\uDFFF
1436false 3
1437
1438((\uD800)(\uDFFF))
1439\uD800\uDFFF
1440false 3
1441
1442(\uD800(\uDFFF)\uDFFF)
1443\uD800\uDFFF
1444false 2
1445
1446(\uDFFF(\uD800)(\uDBFF))
1447\uDFFF\uD800\uDBFF
1448true \uDFFF\uD800\uDBFF 3 \uDFFF\uD800\uDBFF \uD800 \uDBFF
1449
1450(\uDFFF(\uD800)(\uDC00))
1451\uDFFF\uD800\uDC00
1452false 3
1453
1454// Android-removed: Looks like a faulty test case, unless due to some UTF-16 rules for regex.
1455// (\uDFFF\uD800(\uDC00\uDBFF))
1456// \uDFFF\uD800\uDC00\uDBFF
1457// false 2
1458
1459(\uD800\uDFFF(\uDBFF)(\uDC00))
1460\uD800\uDFFF\uDBFF\uDC00
1461false 3
1462
1463(\uD800\uDFFF(\uDBFF\uDC00))
1464\uD800\uDFFF\uDBFF\uDC00
1465true \uD800\uDFFF\uDBFF\uDC00 2 \uD800\uDFFF\uDBFF\uDC00 \uDBFF\uDC00
1466