1//
2// Copyright (c) 1999, 2009, 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 BMP 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^(\u3042)?\u3042
34\u3042
35true \u3042 1
36
37^(\u3042\u3042(\u3043\u3043)?)+$
38\u3042\u3042\u3043\u3043\u3042\u3042
39true \u3042\u3042\u3043\u3043\u3042\u3042 2 \u3042\u3042 \u3043\u3043
40
41((\u3042|\u3043)?\u3043)+
42\u3043
43true \u3043 2 \u3043
44
45(\u3042\u3042\u3042)?\u3042\u3042\u3042
46\u3042\u3042\u3042
47true \u3042\u3042\u3042 1
48
49^(\u3042(\u3043)?)+$
50\u3042\u3043\u3042
51true \u3042\u3043\u3042 2 \u3042 \u3043
52
53^(\u3042(\u3043(\u3044)?)?)?\u3042\u3043\u3044
54\u3042\u3043\u3044
55true \u3042\u3043\u3044 3
56
57^(\u3042(\u3043(\u3044))).*
58\u3042\u3043\u3044
59true \u3042\u3043\u3044 3 \u3042\u3043\u3044 \u3043\u3044 \u3044
60
61// use of x modifier
62\u3042\u3043\u3044(?x)\u3043la\u3049
63\u3042\u3043\u3044\u3043la\u3049
64true \u3042\u3043\u3044\u3043la\u3049 0
65
66\u3042\u3043\u3044(?x)  bla\u3049
67\u3042\u3043\u3044bla\u3049
68true \u3042\u3043\u3044bla\u3049 0
69
70\u3042\u3043\u3044(?x)  bla\u3049  ble\u3044\u3049
71\u3042\u3043\u3044bla\u3049ble\u3044\u3049
72true \u3042\u3043\u3044bla\u3049ble\u3044\u3049 0
73
74\u3042\u3043\u3044(?x)  bla\u3049 # ignore comment
75\u3042\u3043\u3044bla\u3049
76true \u3042\u3043\u3044bla\u3049 0
77
78// Simple alternation
79\u3042|\u3043
80\u3042
81true \u3042 0
82
83\u3042|\u3043
84\u305B
85false 0
86
87\u3042|\u3043
88\u3043
89true \u3043 0
90
91\u3042|\u3043|\u3044\u3045
92\u3044\u3045
93true \u3044\u3045 0
94
95\u3042|\u3042\u3045
96\u3042\u3045
97true \u3042 0
98
99\u305B(\u3042|\u3042\u3044)\u3043
100\u305B\u3042\u3044\u3043
101true \u305B\u3042\u3044\u3043 1 \u3042\u3044
102
103// Simple char class
104[\u3042\u3043\u3044]+
105\u3042\u3043\u3042\u3043\u3042\u3043
106true \u3042\u3043\u3042\u3043\u3042\u3043 0
107
108[\u3042\u3043\u3044]+
109\u3045\u3046\u3047\u3048
110false 0
111
112[\u3042\u3043\u3044]+[\u3045\u3046\u3047]+[\u3048\u3049\u304A]+
113\u305B\u305B\u305B\u3042\u3042\u3045\u3045\u3048\u3048\u305B\u305B\u305B
114true \u3042\u3042\u3045\u3045\u3048\u3048 0
115
116// Range char class
117[\u3042-\u3048]+
118\u305B\u305B\u305B\u3048\u3048\u3048
119true \u3048\u3048\u3048 0
120
121[\u3042-\u3048]+
122mmm
123false 0
124
125[\u3042-]+
126\u305B\u3042-9\u305B
127true \u3042- 0
128
129[\u3042-\\u4444]+
130\u305B\u3042-9\u305B
131true \u305B\u3042 0
132
133// Negated char class
134[^\u3042\u3043\u3044]+
135\u3042\u3043\u3042\u3043\u3042\u3043
136false 0
137
138[^\u3042\u3043\u3044]+
139\u3042\u3042\u3042\u3043\u3043\u3043\u3044\u3044\u3044\u3045\u3046\u3047\u3048
140true \u3045\u3046\u3047\u3048 0
141
142// Making sure a ^ not in first position matches literal ^
143[\u3042\u3043\u3044^\u3043]
144\u3043
145true \u3043 0
146
147[\u3042\u3043\u3044^\u3043]
148^
149true ^ 0
150
151// Class union and intersection
152[\u3042\u3043\u3044[\u3045\u3046\u3047]]
153\u3043
154true \u3043 0
155
156[\u3042\u3043\u3044[\u3045\u3046\u3047]]
157\u3046
158true \u3046 0
159
160[\u3042-\u3045[0-9][\u304e-\u3051]]
161\u3042
162true \u3042 0
163
164[\u3042-\u3045[0-9][\u304e-\u3051]]
165\u3050
166true \u3050 0
167
168[\u3042-\u3045[0-9][\u304e-\u3051]]
1694
170true 4 0
171
172[\u3042-\u3045[0-9][\u304e-\u3051]]
173\u3046
174false 0
175
176[\u3042-\u3045[0-9][\u304e-\u3051]]
177\u3056
178false 0
179
180[[\u3042-\u3045][0-9][\u304e-\u3051]]
181\u3043
182true \u3043 0
183
184[[\u3042-\u3045][0-9][\u304e-\u3051]]
185\u305B
186false 0
187
188[\u3042-\u3044[\u3045-\u3047[\u3048-\u304A]]]
189\u3042
190true \u3042 0
191
192[\u3042-\u3044[\u3045-\u3047[\u3048-\u304A]]]
193\u3046
194true \u3046 0
195
196[\u3042-\u3044[\u3045-\u3047[\u3048-\u304A]]]
197\u3049
198true \u3049 0
199
200[\u3042-\u3044[\u3045-\u3047[\u3048-\u304A]]]
201m
202false 0
203
204[\u3042-\u3044[\u3045-\u3047[\u3048-\u304A]]m]
205m
206true m 0
207
208[\u3042\u3043\u3044[\u3045\u3046\u3047]\u3048\u3049\u304A]
209\u3042
210true \u3042 0
211
212[\u3042\u3043\u3044[\u3045\u3046\u3047]\u3048\u3049\u304A]
213\u3045
214true \u3045 0
215
216[\u3042\u3043\u3044[\u3045\u3046\u3047]\u3048\u3049\u304A]
217\u3049
218true \u3049 0
219
220[\u3042\u3043\u3044[\u3045\u3046\u3047]\u3048\u3049\u304A]
221w
222false 0
223
224[\u3042-\u3044&&[\u3045-\u3047]]
225\u3042
226false 0
227
228[\u3042-\u3044&&[\u3045-\u3047]]
229\u3046
230false 0
231
232[\u3042-\u3044&&[\u3045-\u3047]]
233\u305B
234false 0
235
236[[\u3042-\u3044]&&[\u3045-\u3047]]
237\u3042
238false 0
239
240[[\u3042-\u3044]&&[\u3045-\u3047]]
241\u3046
242false 0
243
244[[\u3042-\u3044]&&[\u3045-\u3047]]
245\u305B
246false 0
247
248[\u3042-\u3044&&\u3045-\u3047]
249\u3042
250false 0
251
252[\u3042-\u304e&&\u304e-\u305B]
253\u304e
254true \u304e 0
255
256[\u3042-\u304e&&\u304e-\u305B&&\u3042-\u3044]
257\u304e
258false 0
259
260[\u3042-\u304e&&\u304e-\u305B&&\u3042-\u305B]
261\u304e
262true \u304e 0
263
264[[\u3042-\u304e]&&[\u304e-\u305B]]
265\u3042
266false 0
267
268[[\u3042-\u304e]&&[\u304e-\u305B]]
269\u304e
270true \u304e 0
271
272[[\u3042-\u304e]&&[\u304e-\u305B]]
273\u305B
274false 0
275
276[[\u3042-\u304e]&&[^\u3042-\u3044]]
277\u3042
278false 0
279
280[[\u3042-\u304e]&&[^\u3042-\u3044]]
281\u3045
282true \u3045 0
283
284[\u3042-\u304e&&[^\u3042-\u3044]]
285\u3042
286false 0
287
288[\u3042-\u304e&&[^\u3042-\u3044]]
289\u3045
290true \u3045 0
291
292[\u3042-\u3044\u3045-\u3047&&[\u3045-\u3047]]
293\u3042
294false 0
295
296[\u3042-\u3044\u3045-\u3047&&[\u3045-\u3047]]
297\u3046
298true \u3046 0
299
300[[\u3042-\u3044]&&\u3045-\u3047\u3042-\u3044]
301\u3042
302true \u3042 0
303
304[[\u3042-\u3044]&&[\u3045-\u3047][\u3042-\u3044]]
305\u3042
306true \u3042 0
307
308[[\u3042-\u3044][\u3045-\u3047]&&\u3042\u3043\u3044]
309\u3042
310true \u3042 0
311
312[[\u3042-\u3044][\u3045-\u3047]&&\u3042\u3043\u3044[\u3045\u3046\u3047]]
313\u3046
314true \u3046 0
315
316[[\u3042-\u3044]&&[\u3043-\u3045]&&[\u3044-\u3046]]
317\u3042
318false 0
319
320[[\u3042-\u3044]&&[\u3043-\u3045]&&[\u3044-\u3046]]
321\u3044
322true \u3044 0
323
324[[\u3042-\u3044]&&[\u3043-\u3045][\u3044-\u3046]&&[\u3056-\u305B]]
325\u3044
326false 0
327
328[\u3042\u3043\u3044[^\u3043\u3044\u3045]]
329\u3042
330true \u3042 0
331
332[\u3042\u3043\u3044[^\u3043\u3044\u3045]]
333\u3045
334false 0
335
336[\u3042-\u3044&&\u3042-\u3045&&\u3042-\u3046\u3048\u3049\u304A]
337\u3043
338true \u3043 0
339
340[\u3042-\u3044&&\u3042-\u3045&&\u3042-\u3046\u3048\u3049\u304A]
341\u3048
342false 0
343
344[[\u3042[\u3043]]&&[\u3043[\u3042]]]
345\u3042
346true \u3042 0
347
348[[\u3042]&&[\u3043][\u3044][\u3042]&&[^\u3045]]
349\u3042
350true \u3042 0
351
352[[\u3042]&&[b][c][\u3042]&&[^d]]
353\u3042
354true \u3042 0
355
356[[\u3042]&&[\u3043][\u3044][\u3042]&&[^\u3045]]
357\u3045
358false 0
359
360[[[\u3042-\u3045]&&[\u3044-\u3047]]]
361\u3042
362false 0
363
364[[[\u3042-\u3045]&&[\u3044-\u3047]]]
365\u3044
366true \u3044 0
367
368[[[\u3042-\u3045]&&[\u3044-\u3047]]&&[\u3044]]
369\u3044
370true \u3044 0
371
372[[[\u3042-\u3045]&&[\u3044-\u3047]]&&[\u3044]&&\u3044]
373\u3044
374true \u3044 0
375
376[[[\u3042-\u3045]&&[\u3044-\u3047]]&&[\u3044]&&\u3044&&\u3044]
377\u3044
378true \u3044 0
379
380[[[\u3042-\u3045]&&[\u3044-\u3047]]&&[\u3044]&&\u3044&&[\u3044\u3045\u3046]]
381\u3044
382true \u3044 0
383
384[\u305B[\u3042\u3043\u3044&&\u3043\u3044\u3045]]
385\u3044
386true \u3044 0
387
388[\u305B[\u3042\u3043\u3044&&\u3043\u3044\u3045]&&[\u3056-\u305B]]
389\u305B
390true \u305B 0
391
392[\u3059[\u3042\u3043\u3044&&\u3043\u3044\u3045[\u305B]]&&[\u3056-\u305B]]
393\u305B
394false 0
395
396[\u3059[[w\u305B]\u3042\u3043\u3044&&\u3043\u3044\u3045[\u305B]]&&[\u3056-\u305B]]
397\u305B
398true \u305B 0
399
400[[\u3042\u3043\u3044]&&[\u3045\u3046\u3047]\u3042\u3043\u3044]
401\u3042
402true \u3042 0
403
404[[\u3042\u3043\u3044]&&[\u3045\u3046\u3047]\u3059\u305A\u305B[\u3042\u3043\u3044]]
405\u3042
406true \u3042 0
407
408// Android-changed: \pL isn't a known documented syntax.
409// \pL
410\p{L}
411\u3042
412true \u3042 0
413
414// Android-changed: \pL isn't a known documented syntax.
415// \pL
416\p{L}
4177
418false 0
419
420\p{L}
421\u3042
422true \u3042 0
423
424\p{IsL}
425\u3042
426true \u3042 0
427
428\p{InHiragana}
429\u3042
430true \u3042 0
431
432\p{InHiragana}
433\u0370
434false 0
435
436// Android-changed: \pL isn't a known documented syntax.
437// \pL\u3043\u3044
438\p{L}\u3043\u3044
439\u3042\u3043\u3044
440true \u3042\u3043\u3044 0
441
442\u3042[r\p{InGreek}]\u3044
443\u3042\u0370\u3044
444true \u3042\u0370\u3044 0
445
446\u3042\p{InGreek}
447\u3042\u0370
448true \u3042\u0370 0
449
450\u3042\P{InGreek}
451\u3042\u0370
452false 0
453
454\u3042\P{InGreek}
455\u3042\u3043
456true \u3042\u3043 0
457
458\u3042{^InGreek}
459-
460error
461
462\u3042\p{^InGreek}
463-
464error
465
466\u3042\P{^InGreek}
467-
468error
469
470\u3042\p{InGreek}
471\u3042\u0370
472true \u3042\u0370 0
473
474\u3042[\p{InGreek}]\u3044
475\u3042\u0370\u3044
476true \u3042\u0370\u3044 0
477
478\u3042[\P{InGreek}]\u3044
479\u3042\u0370\u3044
480false 0
481
482\u3042[\P{InGreek}]\u3044
483\u3042\u3043\u3044
484true \u3042\u3043\u3044 0
485
486\u3042[{^InGreek}]\u3044
487\u3042n\u3044
488true \u3042n\u3044 0
489
490\u3042[{^InGreek}]\u3044
491\u3042\u305B\u3044
492false 0
493
494\u3042[\p{^InGreek}]\u3044
495-
496error
497
498\u3042[\P{^InGreek}]\u3044
499-
500error
501
502\u3042[\p{InGreek}]
503\u3042\u0370
504true \u3042\u0370 0
505
506\u3042[r\p{InGreek}]\u3044
507\u3042r\u3044
508true \u3042r\u3044 0
509
510\u3042[\p{InGreek}r]\u3044
511\u3042r\u3044
512true \u3042r\u3044 0
513
514\u3042[r\p{InGreek}]\u3044
515\u3042r\u3044
516true \u3042r\u3044 0
517
518\u3042[^\p{InGreek}]\u3044
519\u3042\u0370\u3044
520false 0
521
522\u3042[^\P{InGreek}]\u3044
523\u3042\u0370\u3044
524true \u3042\u0370\u3044 0
525
526\u3042[\p{InGreek}&&[^\u0370]]\u3044
527\u3042\u0370\u3044
528false 0
529
530// Test the dot metacharacter
531\u3042.\u3044.+
532\u3042#\u3044%&
533true \u3042#\u3044%& 0
534
535\u3042\u3043.
536\u3042\u3043\n
537false 0
538
539(?s)\u3042\u3043.
540\u3042\u3043\n
541true \u3042\u3043\n 0
542
543\u3042[\p{L}&&[\P{InGreek}]]\u3044
544\u3042\u6000\u3044
545true \u3042\u6000\u3044 0
546
547\u3042[\p{L}&&[\P{InGreek}]]\u3044
548\u3042r\u3044
549true \u3042r\u3044 0
550
551\u3042[\p{L}&&[\P{InGreek}]]\u3044
552\u3042\u0370\u3044
553false 0
554
555\u3042\p{InGreek}\u3044
556\u3042\u0370\u3044
557true \u3042\u0370\u3044 0
558
559\u3042\p{Sc}
560\u3042$
561true \u3042$ 0
562
563\W\w\W
564rrrr#\u3048\u3048\u3048
565false 0
566
567\u3042\u3043\u3044[\s\u3045\u3046\u3047]*
568\u3042\u3043\u3044  \u3045\u3046\u3047
569true \u3042\u3043\u3044  \u3045\u3046\u3047 0
570
571\u3042\u3043\u3044[\s\u305A-\u305B]*
572\u3042\u3043\u3044 \u305A \u305B
573true \u3042\u3043\u3044 \u305A \u305B 0
574
575\u3042\u3043\u3044[\u3042-\u3045\s\u304e-\u3051]*
576\u3042\u3043\u3044\u3042\u3042 \u304e\u304f  \u3051
577true \u3042\u3043\u3044\u3042\u3042 \u304e\u304f  \u3051 0
578
579// Test the whitespace escape sequence
580\u3042\u3043\s\u3044
581\u3042\u3043 \u3044
582true \u3042\u3043 \u3044 0
583
584\s\s\s
585\u3043l\u3042\u3049  \u3046rr
586false 0
587
588\S\S\s
589\u3043l\u3042\u3049  \u3046rr
590true \u3042\u3049  0
591
592// Test the digit escape sequence
593\u3042\u3043\d\u3044
594\u3042\u30439\u3044
595true \u3042\u30439\u3044 0
596
597\d\d\d
598\u3043l\u3042\u304945
599false 0
600
601// Test the caret metacharacter
602^\u3042\u3043\u3044
603\u3042\u3043\u3044\u3045\u3046\u3047
604true \u3042\u3043\u3044 0
605
606^\u3042\u3043\u3044
607\u3043\u3044\u3045\u3042\u3043\u3044
608false 0
609
610// Greedy ? metacharacter
611\u3042?\u3043
612\u3042\u3042\u3042\u3042\u3043
613true \u3042\u3043 0
614
615\u3042?\u3043
616\u3043
617true \u3043 0
618
619\u3042?\u3043
620\u3042\u3042\u3042\u3044\u3044\u3044
621false 0
622
623.?\u3043
624\u3042\u3042\u3042\u3042\u3043
625true \u3042\u3043 0
626
627// Reluctant ? metacharacter
628\u3042??\u3043
629\u3042\u3042\u3042\u3042\u3043
630true \u3042\u3043 0
631
632\u3042??\u3043
633\u3043
634true \u3043 0
635
636\u3042??\u3043
637\u3042\u3042\u3042\u3044\u3044\u3044
638false 0
639
640.??\u3043
641\u3042\u3042\u3042\u3042\u3043
642true \u3042\u3043 0
643
644// Possessive ? metacharacter
645\u3042?+\u3043
646\u3042\u3042\u3042\u3042\u3043
647true \u3042\u3043 0
648
649\u3042?+\u3043
650\u3043
651true \u3043 0
652
653\u3042?+\u3043
654\u3042\u3042\u3042\u3044\u3044\u3044
655false 0
656
657.?+\u3043
658\u3042\u3042\u3042\u3042\u3043
659true \u3042\u3043 0
660
661// Greedy + metacharacter
662\u3042+\u3043
663\u3042\u3042\u3042\u3042\u3043
664true \u3042\u3042\u3042\u3042\u3043 0
665
666\u3042+\u3043
667\u3043
668false 0
669
670\u3042+\u3043
671\u3042\u3042\u3042\u3044\u3044\u3044
672false 0
673
674.+\u3043
675\u3042\u3042\u3042\u3042\u3043
676true \u3042\u3042\u3042\u3042\u3043 0
677
678// Reluctant + metacharacter
679\u3042+?\u3043
680\u3042\u3042\u3042\u3042\u3043
681true \u3042\u3042\u3042\u3042\u3043 0
682
683\u3042+?\u3043
684\u3043
685false 0
686
687\u3042+?\u3043
688\u3042\u3042\u3042\u3044\u3044\u3044
689false 0
690
691.+?\u3043
692\u3042\u3042\u3042\u3042\u3043
693true \u3042\u3042\u3042\u3042\u3043 0
694
695// Possessive + metacharacter
696\u3042++\u3043
697\u3042\u3042\u3042\u3042\u3043
698true \u3042\u3042\u3042\u3042\u3043 0
699
700\u3042++\u3043
701\u3043
702false 0
703
704\u3042++\u3043
705\u3042\u3042\u3042\u3044\u3044\u3044
706false 0
707
708.++\u3043
709\u3042\u3042\u3042\u3042\u3043
710false 0
711
712// Greedy Repetition
713\u3042{2,3}
714\u3042
715false 0
716
717\u3042{2,3}
718\u3042\u3042
719true \u3042\u3042 0
720
721\u3042{2,3}
722\u3042\u3042\u3042
723true \u3042\u3042\u3042 0
724
725\u3042{2,3}
726\u3042\u3042\u3042\u3042
727true \u3042\u3042\u3042 0
728
729\u3042{3,}
730\u305B\u305B\u305B\u3042\u3042\u3042\u3042\u305B\u305B\u305B
731true \u3042\u3042\u3042\u3042 0
732
733\u3042{3,}
734\u305B\u305B\u305B\u3042\u3042\u305B\u305B\u305B
735false 0
736
737// Reluctant Repetition
738\u3042{2,3}?
739\u3042
740false 0
741
742\u3042{2,3}?
743\u3042\u3042
744true \u3042\u3042 0
745
746\u3042{2,3}?
747\u3042\u3042\u3042
748true \u3042\u3042 0
749
750\u3042{2,3}?
751\u3042\u3042\u3042\u3042
752true \u3042\u3042 0
753
754// Zero width Positive lookahead
755\u3042\u3043\u3044(?=\u3045)
756\u305B\u305B\u305B\u3042\u3043\u3044\u3045
757true \u3042\u3043\u3044 0
758
759\u3042\u3043\u3044(?=\u3045)
760\u305B\u305B\u305B\u3042\u3043\u3044\u3046\u3045
761false 0
762
763// Zero width Negative lookahead
764\u3042\u3043\u3044(?!\u3045)
765\u305B\u305B\u3042\u3043\u3044\u3045
766false 0
767
768\u3042\u3043\u3044(?!\u3045)
769\u305B\u305B\u3042\u3043\u3044\u3046\u3045
770true \u3042\u3043\u3044 0
771
772// Zero width Positive lookbehind
773\u3042(?<=\u3042)
774###\u3042\u3043\u3044
775true \u3042 0
776
777\u3042(?<=\u3042)
778###\u3043\u3044###
779false 0
780
781// Android-removed: Looks like a bug in Android. FIXME
782// Zero width Negative lookbehind
783// (?<!\u3042)\w
784// ###\u3042\u3043\u3044a###
785// true a 0
786
787(?<!\u3042)\u3044
788\u3043\u3044
789true \u3044 0
790
791(?<!\u3042)\u3044
792\u3042\u3044
793false 0
794
795// Nondeterministic group
796(\u3042+\u3043)+
797\u3042\u3043\u3042\u3043\u3042\u3043
798true \u3042\u3043\u3042\u3043\u3042\u3043 1 \u3042\u3043
799
800(\u3042|\u3043)+
801\u3044\u3044\u3044\u3044\u3045
802false 1
803
804// Deterministic group
805(\u3042\u3043)+
806\u3042\u3043\u3042\u3043\u3042\u3043
807true \u3042\u3043\u3042\u3043\u3042\u3043 1 \u3042\u3043
808
809(\u3042\u3043)+
810\u3042\u3044\u3044\u3044\u3044\u3045
811false 1
812
813(\u3042\u3043)*
814\u3042\u3043\u3042\u3043\u3042\u3043
815true \u3042\u3043\u3042\u3043\u3042\u3043 1 \u3042\u3043
816
817(\u3042\u3043)(\u3044\u3045*)
818\u305B\u305B\u305B\u3042\u3043\u3044\u305B\u305B\u305B
819true \u3042\u3043\u3044 2 \u3042\u3043 \u3044
820
821\u3042\u3043\u3044(\u3045)*\u3042\u3043\u3044
822\u3042\u3043\u3044\u3045\u3045\u3045\u3045\u3045\u3042\u3043\u3044
823true \u3042\u3043\u3044\u3045\u3045\u3045\u3045\u3045\u3042\u3043\u3044 1 \u3045
824
825// Back references
826(\u3042*)\u3043\u3044\1
827\u305B\u305B\u305B\u3042\u3042\u3043\u3044\u3042\u3042\u305B\u305B\u305B
828true \u3042\u3042\u3043\u3044\u3042\u3042 1 \u3042\u3042
829
830(\u3042*)\u3043\u3044\1
831\u305B\u305B\u305B\u3042\u3042\u3043\u3044\u3042\u305B\u305B\u305B
832true \u3042\u3043\u3044\u3042 1 \u3042
833
834(\u3048t*)(\u3045\u3045\u3046)*(\u305A\u3056)\1\3(\u3057\u3057)
835\u305B\u305B\u305B\u3048tt\u3045\u3045\u3046\u3045\u3045\u3046\u305A\u3056\u3048tt\u305A\u3056\u3057\u3057\u305B\u305B\u305B
836true \u3048tt\u3045\u3045\u3046\u3045\u3045\u3046\u305A\u3056\u3048tt\u305A\u3056\u3057\u3057 4 \u3048tt \u3045\u3045\u3046 \u305A\u3056 \u3057\u3057
837
838// Greedy * metacharacter
839\u3042*\u3043
840\u3042\u3042\u3042\u3042\u3043
841true \u3042\u3042\u3042\u3042\u3043 0
842
843\u3042*\u3043
844\u3043
845true \u3043 0
846
847\u3042*\u3043
848\u3042\u3042\u3042\u3044\u3044\u3044
849false 0
850
851.*\u3043
852\u3042\u3042\u3042\u3042\u3043
853true \u3042\u3042\u3042\u3042\u3043 0
854
855// Reluctant * metacharacter
856\u3042*?\u3043
857\u3042\u3042\u3042\u3042\u3043
858true \u3042\u3042\u3042\u3042\u3043 0
859
860\u3042*?\u3043
861\u3043
862true \u3043 0
863
864\u3042*?\u3043
865\u3042\u3042\u3042\u3044\u3044\u3044
866false 0
867
868.*?\u3043
869\u3042\u3042\u3042\u3042\u3043
870true \u3042\u3042\u3042\u3042\u3043 0
871
872// Possessive * metacharacter
873\u3042*+\u3043
874\u3042\u3042\u3042\u3042\u3043
875true \u3042\u3042\u3042\u3042\u3043 0
876
877\u3042*+\u3043
878\u3043
879true \u3043 0
880
881\u3042*+\u3043
882\u3042\u3042\u3042\u3044\u3044\u3044
883false 0
884
885.*+\u3043
886\u3042\u3042\u3042\u3042\u3043
887false 0
888
889// Case insensitivity
890(?iu)\uFF46\uFF4F\uFF4F\uFF42\uFF41\uFF52
891\uFF46\uFF2F\uFF4F\uFF42\uFF21\uFF52
892true \uFF46\uFF2F\uFF4F\uFF42\uFF21\uFF52 0
893
894\uFF46(?iu)\uFF4F\uFF4F\uFF42\uFF41\uFF52
895\uFF46\uFF2F\uFF4F\uFF42\uFF21\uFF52
896true \uFF46\uFF2F\uFF4F\uFF42\uFF21\uFF52 0
897
898\uFF46\uFF4F\uFF4F(?iu)\uFF42\uFF41\uFF52
899\uFF46\uFF2F\uFF4F\uFF42\uFF21\uFF52
900false 0
901
902(?iu)\uFF46\uFF4F\uFF4F[\uFF42\uFF41\uFF52]+
903\uFF46\uFF4F\uFF2F\uFF42\uFF21\uFF52
904true \uFF46\uFF4F\uFF2F\uFF42\uFF21\uFF52 0
905
906(?iu)\uFF46\uFF4F\uFF4F[\uFF41-\uFF52]+
907\uFF46\uFF4F\uFF2F\uFF42\uFF21\uFF52
908true \uFF46\uFF4F\uFF2F\uFF42\uFF21\uFF52 0
909
910// Disable metacharacters- test both length <=3 and >3
911// So that the BM optimization is part of test
912\Q***\E\u3042\u3043\u3044
913***\u3042\u3043\u3044
914true ***\u3042\u3043\u3044 0
915
916\u3043l\Q***\E\u3042\u3043\u3044
917\u3043l***\u3042\u3043\u3044
918true \u3043l***\u3042\u3043\u3044 0
919
920\Q***\u3042\u3043\u3044
921***\u3042\u3043\u3044
922true ***\u3042\u3043\u3044 0
923
924\u3043l\u3042\u3049\Q***\E\u3042\u3043\u3044
925\u3043l\u3042\u3049***\u3042\u3043\u3044
926true \u3043l\u3042\u3049***\u3042\u3043\u3044 0
927
928\Q***\u3042\u3043\u3044
929***\u3042\u3043\u3044
930true ***\u3042\u3043\u3044 0
931
932\Q*\u3042\u3043
933*\u3042\u3043
934true *\u3042\u3043 0
935
936\u3043l\u3042\u3049\Q***\u3042\u3043\u3044
937\u3043l\u3042\u3049***\u3042\u3043\u3044
938true \u3043l\u3042\u3049***\u3042\u3043\u3044 0
939
940\u3043l\u3042\Q***\u3042\u3043\u3044
941\u3043l\u3042***\u3042\u3043\u3044
942true \u3043l\u3042***\u3042\u3043\u3044 0
943
944[\043]+
945\u3043l\u3042\u3049\u3043l\u3042\u3049#\u3043le\u3044\u3049
946true # 0
947
948[\042-\044]+
949\u3043l\u3042\u3049\u3043l\u3042\u3049#\u3043le\u3044\u3049
950true # 0
951
952[\u1234-\u1236]
953\u3043l\u3042\u3049\u3043l\u3042\u3049\u1235\u3043le\u3044\u3049
954true \u1235 0
955
956[^\043]*
957\u3043l\u3042\u3049\u3043l\u3042\u3049#\u3043le\u3044\u3049
958true \u3043l\u3042\u3049\u3043l\u3042\u3049 0
959