Oregami
Repositories/oxedyne/fe2o3

oxedyne/fe2o3/fe2o3_text/tests/regex_oracle/corpus.txt

6.8 KiB, 1 run

created by r1870400018:60336, which is this file's identity for as long as the history lasts, whatever it is later renamed to

download · who wrote it · its history

1# The regular expression corpus that oracle.pl runs through Perl to write expected.txt.
2#
3# P a pattern, in the syntax of the Rust `regex` crate
4# Q the same pattern in Perl's syntax, where the two differ (`\p{Greek}` is Script in Rust
5# and Script_Extensions in Perl; `\u{..}`, `\<` and class set operations are Rust's only)
6# R a replacement template, expanded as the `regex` crate expands one
7# H a haystack; `\n`, `\t` and `\x{..}` are decoded, so a haystack cannot hold a backslash
8#
9# Every H is run against the P above it. A group inside a repetition keeps its capture from an
10# earlier iteration in the `regex` crate (and in Python) but is reset in Perl, so no such case is
11# here; tests/regex.rs checks those against Python's answers. Nor is a repetition whose later
12# iteration can match nothing, `(a*)+`, where Perl and Python report the empty last iteration and
13# the crate does not; rust_suite.txt carries the crate's own cases for that. Perl's `$` also matches before a final newline and
14# Rust's does not, so no haystack under a `$` pattern ends in one; Perl's case-insensitivity
15# folds `ß` to `ss` and Rust's does not, so no case-insensitive pattern meets an `ß`.
16
17# Literals and dot
18P abc
19H xxabcxxabc
20H ab
21P a.c
22H abc a\nc a\x{3bb}c
23P (?s)a.c
24H a\nc abc
25
26# Classes
27P [a-c]+
28H zzabcbazz ab c
29P [^a-c\s]+
30H ab xyz\tcab
31P [\d.]+x
32H 3.14x and 1x
33P [\]\-]+
34H a]-]b
35P [a-z&&[^aeiou]]+
36Q (?:(?![aeiou])[a-z])+
37H rhythm and blues
38P [a-z--[aeiou]]+
39Q (?:(?![aeiou])[a-z])+
40H strengths
41P [a-f~~c-h]+
42Q [abgh]+
43H abcdefghij
44P [[:alpha:]]+
45Q [A-Za-z]+
46H abc\x{3bb}\x{3bc}DEF12
47P [[:^digit:][:space:]]+
48Q [^0-9]+
49H 12ab 34
50P [[:punct:]]+
51Q [!-\/:-\@\[-`{-~]+
52H a,b;c!?d
53
54# Unicode shorthands
55P \d+
56H x\x{661}\x{662}\x{663}y 42 \x{ff11}\x{ff12} \x{966}\x{967}
57P \w+
58H caf\x{e9} na\x{ef}ve \x{3bb}\x{3cc}\x{3b3}\x{3bf}\x{3c2} e\x{301}t\x{e9} a_b \x{4e2d}\x{6587}
59P \s+
60H a\x{a0}b\x{3000}c\x{2028}d\x{85}e\x{1680}f
61P \S+
62H a\x{a0}b\x{3000}c
63P \W+
64H ab, \x{3bb}; \x{200d}!
65P \D+
66H \x{661}a\x{662}
67
68# Boundaries
69P \bcat\b
70H cat concat cat. (cat)
71P \Bcat\B
72H concatenate cat
73P \b\w+\b
74H \x{3bb}\x{3cc}\x{3b3}\x{3bf}\x{3c2} \x{3ba}\x{3b1}\x{3b9}! caf\x{e9}
75P \b
76H ab cd
77P \B
78H ab c
79P \<\w+
80Q (?<!\w)(?=\w)\w+
81H ab cd, ef
82P \w+\>
83Q \w+(?<=\w)(?!\w)
84H ab cd, ef
85P \b{start}.
86Q (?<!\w)(?=\w).
87H x y,z
88P .\b{end}
89Q .(?<=\w)(?!\w)
90H x y,z
91P \b{start-half}.
92Q (?<!\w).
93H ab c
94P .\b{end-half}
95Q .(?!\w)
96H ab c
97
98# Anchors and multi-line
99P ^\w+
100H ab cd
101H \x{3bb}x
102P \w+$
103H ab cd
104P (?m)^\w+
105H ab\ncd\nef
106P (?m)\w+$
107H ab\ncd\nef
108P \A\w
109H ab
110P \w\z
111H ab
112P (?m)^$
113H a\n\nb
114
115# Quantifiers
116P a{2,3}
117H aaaaaaa
118P a{2,}?
119H aaaaa
120P a{3}
121H aaaaaaa
122P a+?b
123H aaab
124P <.*?>
125H <a><bc>
126P <.*>
127H <a><bc>
128P x*
129H axxb
130P (ab)*c
131H abababc c abc
132P a?
133H baa
134
135# Alternation
136P a|ab
137H ab
138P ab|a
139H ab
140P cat|dog|bird
141H a dog and a bird and a cat
142P (?:a|b)+c
143H abbac
144
145# Capture groups
146P (\w+)@(\w+)\.com
147H mail joe@site.com and ann@web.com
148P (a)|(b)
149H ab
150P (a|(b))+
151H ba
152P (?P<year>\d{4})-(?P<month>\d{2})
153R $month/$year
154H 2026-09 and 1999-12
155P (?<first>\w)(?<rest>\w*)
156R ${rest}${first}ay
157H pig latin
158P (\d)(\d)?
159R [$2$1]
160H 1 23 456
161P (a*)*
162H b
163P ()
164H ab
165P (x)?y
166H y xy
167P (\p{Lu})(\p{Ll}+)
168R $2$1
169H Alpha Beta gamma \x{394}\x{3ad}\x{3bb}\x{3c4}\x{3b1}
170
171# Unicode properties
172P \p{L}+
173H ab12\x{3bb}\x{3bc}-\x{4e2d}\x{6587} \x{627}\x{644}
174P \pL+
175H ab12\x{3bb}
176P \PL+
177H ab12\x{3bb}--c
178P \p{Lu}
179H aBc\x{394}\x{3b4}
180P \p{Ll}+
181H aBc\x{394}\x{3b4}
182P \p{Uppercase_Letter}+
183H aBC\x{394}\x{3b4}
184P \p{gc=Nd}+
185H ab\x{661}\x{662}12
186P \p{General_Category=Decimal_Number}+
187H ab\x{661}\x{662}12
188P \p{Letter}+
189H x1y
190P \p{N}+
191H x\x{bd}\x{2163}9y
192P \p{Nl}
193H x\x{2163}9y
194P \p{No}
195H x\x{bd}9y
196P \p{P}+
197H a,.!?b\x{201c}c\x{201d}
198P \p{Ps}\p{Pe}
199H ()[]{}
200P \p{S}+
201H a+\x{20ac}$\x{a9}b
202P \p{Sc}
203H a$\x{20ac}\x{a3}b
204P \p{Z}+
205H a \x{a0}\x{2028}b
206P \p{Zs}+
207H a \x{a0}\x{2028}b
208P \p{Cc}+
209H a\tb\x{7f}c
210P \p{Cf}
211H a\x{200b}\x{ad}b
212P \p{M}+
213H e\x{301}\x{302}a\x{93f}
214P \p{Mn}+
215H e\x{301}\x{302}a\x{93f}
216P \p{Mc}
217H e\x{301}a\x{93f}
218P \p{LC}+
219H a\x{2c6}B\x{1c5}
220P \p{gc!=L}+
221Q \P{L}+
222H ab12cd
223P \p{Greek}+
224Q \p{sc=Greek}+
225H abc\x{3bb}\x{3cc}\x{3b3}\x{3bf}\x{3c2}\x{b7}x
226P \p{sc=Grek}+
227H \x{3bb}\x{3cc}\x{342}\x{3b3}
228P \p{scx=Grek}+
229H \x{3bb}\x{3cc}\x{342}\x{3b3}
230P \p{Script_Extensions=Greek}+
231Q \p{scx=Grek}+
232H \x{3bb}\x{3cc}\x{342}\x{3b3}
233P \p{Latin}+
234Q \p{sc=Latin}+
235H caf\x{e9} \x{3bb}
236P \p{Han}+
237Q \p{sc=Han}+
238H \x{4e2d}\x{6587}\x{3001}x
239P \p{scx=Hani}+
240H \x{4e2d}\x{6587}\x{3001}x
241P \p{Cyrillic}+
242Q \p{sc=Cyrillic}+
243H \x{41f}\x{440}\x{438}\x{432}\x{435}\x{442} mir
244P \p{Arabic}+
245Q \p{sc=Arabic}+
246H \x{627}\x{644}\x{633}\x{644}\x{627}\x{645} \x{660}
247P \p{scx=Arab}+
248H \x{627}\x{644}\x{60c}\x{660}
249P \p{Common}+
250Q \p{sc=Common}+
251H ab 12,\x{3000}
252P \p{Inherited}+
253Q \p{sc=Inherited}+
254H e\x{301}\x{302}x
255P \p{Devanagari}+
256Q \p{sc=Devanagari}+
257H \x{928}\x{92e}\x{938}\x{94d}\x{924}\x{947} \x{966}
258P \p{Hiragana}+
259Q \p{sc=Hiragana}+
260H \x{3072}\x{3089}\x{304c}\x{306a}\x{30ab}\x{30bf}
261P \P{Greek}+
262Q \P{sc=Greek}+
263H ab\x{3bb}cd
264P \p{sc!=Latin}+
265Q \P{sc=Latin}+
266H ab\x{3bb}\x{3bc}cd
267P \p{Alphabetic}+
268H x\x{2163}y1
269P \p{Alpha}+
270Q \p{Alphabetic}+
271H x\x{2163}y1
272P \p{White_Space}+
273H a \x{85}\x{2029}b
274P \p{WSpace}+
275Q \p{White_Space}+
276H a \x{85}b
277P \p{Uppercase}+
278H a\x{2160}B\x{24b6}c
279P \p{Lowercase}+
280H A\x{aa}b\x{2170}C
281P \p{Emoji}+
282H a\x{1f600}\x{2764}#1
283P \p{Extended_Pictographic}+
284H a\x{1f600}\x{2764}\x{a9}#1
285P \p{Emoji_Presentation}+
286H a\x{1f600}\x{2764}#
287P \p{Ideographic}+
288H \x{4e2d}\x{3007}a
289P \p{Math}+
290H a+\x{2211}=b
291P \p{Dash}+
292H a-\x{2014}b
293P \p{Hex_Digit}+
294H xyzAF09\x{ff21}g
295P \p{Any}+
296H a\x{3bb}\n\x{1f600}
297P \p{ASCII}+
298H ab\x{3bb}cd
299P \p{Assigned}+
300H ab\x{378}cd
301P \p{Cn}+
302H ab\x{378}\x{379}cd
303P \p{is Greek}+
304Q \p{sc=Greek}+
305H ab\x{3bb}
306P \p{ letter }+
307Q \p{L}+
308H 1ab2
309P \p{lowercase-letter}+
310Q \p{Ll}+
311H ABcdEF
312P \p{gc=lowercaseletter}+
313Q \p{Ll}+
314H ABcdEF
315P [\p{Greek}\d]+
316Q [\p{sc=Greek}\d]+
317H ab\x{3bb}12\x{3bc}c
318P [^\p{L}\s]+
319H ab, 12 \x{3bb};
320P [\p{L}&&\p{Greek}]+
321Q (?:(?=\p{sc=Greek})\p{L})+
322H a\x{3bb}\x{375}\x{3bc}b
323P [\p{L}--\p{Latin}]+
324Q (?:(?!\p{sc=Latin})\p{L})+
325H ab\x{3bb}\x{3bc}\x{4e2d}c
326P [\P{L}a]+
327H xa1b2
328P [\w--\d]+
329Q (?:(?!\d)\w)+
330H ab12c_d3
331
332# Flags
333P (?i)hello
334H say HeLLo there
335P (?i)[a-c]+
336H xABCy
337P (?i)[^a]
338H aAb
339P (?i)\x{3a3}\x{39f}\x{3a6}
340H \x{3c3}\x{3bf}\x{3c6} \x{3c2}\x{3bf}\x{3c6}
341P (?i)k
342H K\x{212a}k
343P (?i)s
344H \x{17f}S
345P (?i)\p{Lu}+
346H aBc
347P (?i)\P{Lu}+
348Q (?i)[^\p{Lu}\p{Ll}\p{Lt}]+
349H aB1c;
350P a(?i:b)c
351H abc aBc abC
352P (?i)a(?-i)b
353H Ab AB ab
354P (?i:a|b)c
355H Ac Bc aC
356P (?x) a \s+ b # comment
357Q (?x) a \s+ b
358H a b ab
359P (?x) \d{2} - \d{2}
360H 12-34
361P (?s:.)+
362H a\nb
363P (?m:^b)
364H a\nb
365
366# Escapes
367P \x41\x{3bb}\u{3bc}
368Q \x41\x{3bb}\x{3bc}
369H xA\x{3bb}\x{3bc}y
370P A\U0001F600
371Q \x{41}\x{1f600}
372H A\x{1f600}
373P \t\x{0A}
374H a\t\nb
375P \.\+\*\?\(\)\|\[\]\{\}\^\$\#\&\-\~
376Q \.\+\*\?\(\)\|\[\]\{\}\^\$\#\&\-\~
377H .+*?()|[]{}^$#&-~
378
379# Multibyte haystacks
380P \x{1f600}+
381H a\x{1f600}\x{1f600}b\x{1f600}
382P \w+
383H \x{928}\x{92e}\x{938}\x{94d}\x{924}\x{947} \x{1f600}x
384P .
385H \x{1f600}\x{e9}a
386P .\x{301}
387H e\x{301}