Annotation of embedaddon/pcre/testdata/testinput1, revision 1.1.1.5
1.1 misho 1: /-- This set of tests is for features that are compatible with all versions of
1.1.1.5 ! misho 2: Perl >= 5.10, in non-UTF-8 mode. It should run clean for the 8-bit, 16-bit,
! 3: and 32-bit PCRE libraries. --/
! 4:
! 5: < forbid 89?=ABCDEFfGILMNPTUWXZ<
1.1 misho 6:
7: /the quick brown fox/
8: the quick brown fox
9: The quick brown FOX
10: What do you know about the quick brown fox?
11: What do you know about THE QUICK BROWN FOX?
12:
13: /The quick brown fox/i
14: the quick brown fox
15: The quick brown FOX
16: What do you know about the quick brown fox?
17: What do you know about THE QUICK BROWN FOX?
18:
19: /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/
20: abcd\t\n\r\f\a\e9;\$\\?caxyz
21:
22: /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
23: abxyzpqrrrabbxyyyypqAzz
24: abxyzpqrrrabbxyyyypqAzz
25: aabxyzpqrrrabbxyyyypqAzz
26: aaabxyzpqrrrabbxyyyypqAzz
27: aaaabxyzpqrrrabbxyyyypqAzz
28: abcxyzpqrrrabbxyyyypqAzz
29: aabcxyzpqrrrabbxyyyypqAzz
30: aaabcxyzpqrrrabbxyyyypAzz
31: aaabcxyzpqrrrabbxyyyypqAzz
32: aaabcxyzpqrrrabbxyyyypqqAzz
33: aaabcxyzpqrrrabbxyyyypqqqAzz
34: aaabcxyzpqrrrabbxyyyypqqqqAzz
35: aaabcxyzpqrrrabbxyyyypqqqqqAzz
36: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
37: aaaabcxyzpqrrrabbxyyyypqAzz
38: abxyzzpqrrrabbxyyyypqAzz
39: aabxyzzzpqrrrabbxyyyypqAzz
40: aaabxyzzzzpqrrrabbxyyyypqAzz
41: aaaabxyzzzzpqrrrabbxyyyypqAzz
42: abcxyzzpqrrrabbxyyyypqAzz
43: aabcxyzzzpqrrrabbxyyyypqAzz
44: aaabcxyzzzzpqrrrabbxyyyypqAzz
45: aaaabcxyzzzzpqrrrabbxyyyypqAzz
46: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
47: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
48: aaabcxyzpqrrrabbxyyyypABzz
49: aaabcxyzpqrrrabbxyyyypABBzz
50: >>>aaabxyzpqrrrabbxyyyypqAzz
51: >aaaabxyzpqrrrabbxyyyypqAzz
52: >>>>abcxyzpqrrrabbxyyyypqAzz
53: *** Failers
54: abxyzpqrrabbxyyyypqAzz
55: abxyzpqrrrrabbxyyyypqAzz
56: abxyzpqrrrabxyyyypqAzz
57: aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
58: aaaabcxyzzzzpqrrrabbbxyyypqAzz
59: aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
60:
61: /^(abc){1,2}zz/
62: abczz
63: abcabczz
64: *** Failers
65: zz
66: abcabcabczz
67: >>abczz
68:
69: /^(b+?|a){1,2}?c/
70: bc
71: bbc
72: bbbc
73: bac
74: bbac
75: aac
76: abbbbbbbbbbbc
77: bbbbbbbbbbbac
78: *** Failers
79: aaac
80: abbbbbbbbbbbac
81:
82: /^(b+|a){1,2}c/
83: bc
84: bbc
85: bbbc
86: bac
87: bbac
88: aac
89: abbbbbbbbbbbc
90: bbbbbbbbbbbac
91: *** Failers
92: aaac
93: abbbbbbbbbbbac
94:
95: /^(b+|a){1,2}?bc/
96: bbc
97:
98: /^(b*|ba){1,2}?bc/
99: babc
100: bbabc
101: bababc
102: *** Failers
103: bababbc
104: babababc
105:
106: /^(ba|b*){1,2}?bc/
107: babc
108: bbabc
109: bababc
110: *** Failers
111: bababbc
112: babababc
113:
114: /^\ca\cA\c[\c{\c:/
115: \x01\x01\e;z
116:
117: /^[ab\]cde]/
118: athing
119: bthing
120: ]thing
121: cthing
122: dthing
123: ething
124: *** Failers
125: fthing
126: [thing
127: \\thing
128:
129: /^[]cde]/
130: ]thing
131: cthing
132: dthing
133: ething
134: *** Failers
135: athing
136: fthing
137:
138: /^[^ab\]cde]/
139: fthing
140: [thing
141: \\thing
142: *** Failers
143: athing
144: bthing
145: ]thing
146: cthing
147: dthing
148: ething
149:
150: /^[^]cde]/
151: athing
152: fthing
153: *** Failers
154: ]thing
155: cthing
156: dthing
157: ething
158:
159: /^\/
160:
161:
162: /^/
163:
164:
165: /^[0-9]+$/
166: 0
167: 1
168: 2
169: 3
170: 4
171: 5
172: 6
173: 7
174: 8
175: 9
176: 10
177: 100
178: *** Failers
179: abc
180:
181: /^.*nter/
182: enter
183: inter
184: uponter
185:
186: /^xxx[0-9]+$/
187: xxx0
188: xxx1234
189: *** Failers
190: xxx
191:
192: /^.+[0-9][0-9][0-9]$/
193: x123
194: xx123
195: 123456
196: *** Failers
197: 123
198: x1234
199:
200: /^.+?[0-9][0-9][0-9]$/
201: x123
202: xx123
203: 123456
204: *** Failers
205: 123
206: x1234
207:
208: /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
209: abc!pqr=apquxz.ixr.zzz.ac.uk
210: *** Failers
211: !pqr=apquxz.ixr.zzz.ac.uk
212: abc!=apquxz.ixr.zzz.ac.uk
213: abc!pqr=apquxz:ixr.zzz.ac.uk
214: abc!pqr=apquxz.ixr.zzz.ac.ukk
215:
216: /:/
217: Well, we need a colon: somewhere
218: *** Fail if we don't
219:
220: /([\da-f:]+)$/i
221: 0abc
222: abc
223: fed
224: E
225: ::
226: 5f03:12C0::932e
227: fed def
228: Any old stuff
229: *** Failers
230: 0zzz
231: gzzz
232: fed\x20
233: Any old rubbish
234:
235: /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/
236: .1.2.3
237: A.12.123.0
238: *** Failers
239: .1.2.3333
240: 1.2.3
241: 1234.2.3
242:
243: /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
244: 1 IN SOA non-sp1 non-sp2(
245: 1 IN SOA non-sp1 non-sp2 (
246: *** Failers
247: 1IN SOA non-sp1 non-sp2(
248:
249: /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/
250: a.
251: Z.
252: 2.
253: ab-c.pq-r.
254: sxk.zzz.ac.uk.
255: x-.y-.
256: *** Failers
257: -abc.peq.
258:
259: /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/
260: *.a
261: *.b0-a
262: *.c3-b.c
263: *.c-a.b-c
264: *** Failers
265: *.0
266: *.a-
267: *.a-b.c-
268: *.c-a.0-c
269:
270: /^(?=ab(de))(abd)(e)/
271: abde
272:
273: /^(?!(ab)de|x)(abd)(f)/
274: abdf
275:
276: /^(?=(ab(cd)))(ab)/
277: abcd
278:
279: /^[\da-f](\.[\da-f])*$/i
280: a.b.c.d
281: A.B.C.D
282: a.b.c.1.2.3.C
283:
284: /^\".*\"\s*(;.*)?$/
285: \"1234\"
286: \"abcd\" ;
287: \"\" ; rhubarb
288: *** Failers
289: \"1234\" : things
290:
291: /^$/
292: \
293: *** Failers
294:
295: / ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/x
296: ab c
297: *** Failers
298: abc
299: ab cde
300:
301: /(?x) ^ a (?# begins with a) b\sc (?# then b c) $ (?# then end)/
302: ab c
303: *** Failers
304: abc
305: ab cde
306:
307: /^ a\ b[c ]d $/x
308: a bcd
309: a b d
310: *** Failers
311: abcd
312: ab d
313:
314: /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
315: abcdefhijklm
316:
317: /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/
318: abcdefhijklm
319:
320: /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/
321: a+ Z0+\x08\n\x1d\x12
322:
323: /^[.^$|()*+?{,}]+/
324: .^\$(*+)|{?,?}
325:
326: /^a*\w/
327: z
328: az
329: aaaz
330: a
331: aa
332: aaaa
333: a+
334: aa+
335:
336: /^a*?\w/
337: z
338: az
339: aaaz
340: a
341: aa
342: aaaa
343: a+
344: aa+
345:
346: /^a+\w/
347: az
348: aaaz
349: aa
350: aaaa
351: aa+
352:
353: /^a+?\w/
354: az
355: aaaz
356: aa
357: aaaa
358: aa+
359:
360: /^\d{8}\w{2,}/
361: 1234567890
362: 12345678ab
363: 12345678__
364: *** Failers
365: 1234567
366:
367: /^[aeiou\d]{4,5}$/
368: uoie
369: 1234
370: 12345
371: aaaaa
372: *** Failers
373: 123456
374:
375: /^[aeiou\d]{4,5}?/
376: uoie
377: 1234
378: 12345
379: aaaaa
380: 123456
381:
382: /\A(abc|def)=(\1){2,3}\Z/
383: abc=abcabc
384: def=defdefdef
385: *** Failers
386: abc=defdef
387:
388: /^(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\11*(\3\4)\1(?#)2$/
389: abcdefghijkcda2
390: abcdefghijkkkkcda2
391:
392: /(cat(a(ract|tonic)|erpillar)) \1()2(3)/
393: cataract cataract23
394: catatonic catatonic23
395: caterpillar caterpillar23
396:
397:
398: /^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/
399: From abcd Mon Sep 01 12:33:02 1997
400:
401: /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/
402: From abcd Mon Sep 01 12:33:02 1997
403: From abcd Mon Sep 1 12:33:02 1997
404: *** Failers
405: From abcd Sep 01 12:33:02 1997
406:
407: /^12.34/s
408: 12\n34
409: 12\r34
410:
411: /\w+(?=\t)/
412: the quick brown\t fox
413:
414: /foo(?!bar)(.*)/
415: foobar is foolish see?
416:
417: /(?:(?!foo)...|^.{0,2})bar(.*)/
418: foobar crowbar etc
419: barrel
420: 2barrel
421: A barrel
422:
423: /^(\D*)(?=\d)(?!123)/
424: abc456
425: *** Failers
426: abc123
427:
428: /^1234(?# test newlines
429: inside)/
430: 1234
431:
432: /^1234 #comment in extended re
433: /x
434: 1234
435:
436: /#rhubarb
437: abcd/x
438: abcd
439:
440: /^abcd#rhubarb/x
441: abcd
442:
443: /^(a)\1{2,3}(.)/
444: aaab
445: aaaab
446: aaaaab
447: aaaaaab
448:
449: /(?!^)abc/
450: the abc
451: *** Failers
452: abc
453:
454: /(?=^)abc/
455: abc
456: *** Failers
457: the abc
458:
459: /^[ab]{1,3}(ab*|b)/
460: aabbbbb
461:
462: /^[ab]{1,3}?(ab*|b)/
463: aabbbbb
464:
465: /^[ab]{1,3}?(ab*?|b)/
466: aabbbbb
467:
468: /^[ab]{1,3}(ab*?|b)/
469: aabbbbb
470:
471: / (?: [\040\t] | \(
472: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
473: \) )* # optional leading comment
474: (?: (?:
475: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
476: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
477: |
478: " (?: # opening quote...
479: [^\\\x80-\xff\n\015"] # Anything except backslash and quote
480: | # or
481: \\ [^\x80-\xff] # Escaped something (something != CR)
482: )* " # closing quote
483: ) # initial word
484: (?: (?: [\040\t] | \(
485: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
486: \) )* \. (?: [\040\t] | \(
487: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
488: \) )* (?:
489: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
490: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
491: |
492: " (?: # opening quote...
493: [^\\\x80-\xff\n\015"] # Anything except backslash and quote
494: | # or
495: \\ [^\x80-\xff] # Escaped something (something != CR)
496: )* " # closing quote
497: ) )* # further okay, if led by a period
498: (?: [\040\t] | \(
499: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
500: \) )* @ (?: [\040\t] | \(
501: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
502: \) )* (?:
503: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
504: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
505: | \[ # [
506: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
507: \] # ]
508: ) # initial subdomain
509: (?: #
510: (?: [\040\t] | \(
511: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
512: \) )* \. # if led by a period...
513: (?: [\040\t] | \(
514: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
515: \) )* (?:
516: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
517: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
518: | \[ # [
519: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
520: \] # ]
521: ) # ...further okay
522: )*
523: # address
524: | # or
525: (?:
526: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
527: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
528: |
529: " (?: # opening quote...
530: [^\\\x80-\xff\n\015"] # Anything except backslash and quote
531: | # or
532: \\ [^\x80-\xff] # Escaped something (something != CR)
533: )* " # closing quote
534: ) # one word, optionally followed by....
535: (?:
536: [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] | # atom and space parts, or...
537: \(
538: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
539: \) | # comments, or...
540:
541: " (?: # opening quote...
542: [^\\\x80-\xff\n\015"] # Anything except backslash and quote
543: | # or
544: \\ [^\x80-\xff] # Escaped something (something != CR)
545: )* " # closing quote
546: # quoted strings
547: )*
548: < (?: [\040\t] | \(
549: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
550: \) )* # leading <
551: (?: @ (?: [\040\t] | \(
552: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
553: \) )* (?:
554: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
555: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
556: | \[ # [
557: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
558: \] # ]
559: ) # initial subdomain
560: (?: #
561: (?: [\040\t] | \(
562: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
563: \) )* \. # if led by a period...
564: (?: [\040\t] | \(
565: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
566: \) )* (?:
567: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
568: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
569: | \[ # [
570: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
571: \] # ]
572: ) # ...further okay
573: )*
574:
575: (?: (?: [\040\t] | \(
576: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
577: \) )* , (?: [\040\t] | \(
578: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
579: \) )* @ (?: [\040\t] | \(
580: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
581: \) )* (?:
582: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
583: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
584: | \[ # [
585: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
586: \] # ]
587: ) # initial subdomain
588: (?: #
589: (?: [\040\t] | \(
590: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
591: \) )* \. # if led by a period...
592: (?: [\040\t] | \(
593: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
594: \) )* (?:
595: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
596: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
597: | \[ # [
598: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
599: \] # ]
600: ) # ...further okay
601: )*
602: )* # further okay, if led by comma
603: : # closing colon
604: (?: [\040\t] | \(
605: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
606: \) )* )? # optional route
607: (?:
608: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
609: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
610: |
611: " (?: # opening quote...
612: [^\\\x80-\xff\n\015"] # Anything except backslash and quote
613: | # or
614: \\ [^\x80-\xff] # Escaped something (something != CR)
615: )* " # closing quote
616: ) # initial word
617: (?: (?: [\040\t] | \(
618: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
619: \) )* \. (?: [\040\t] | \(
620: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
621: \) )* (?:
622: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
623: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
624: |
625: " (?: # opening quote...
626: [^\\\x80-\xff\n\015"] # Anything except backslash and quote
627: | # or
628: \\ [^\x80-\xff] # Escaped something (something != CR)
629: )* " # closing quote
630: ) )* # further okay, if led by a period
631: (?: [\040\t] | \(
632: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
633: \) )* @ (?: [\040\t] | \(
634: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
635: \) )* (?:
636: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
637: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
638: | \[ # [
639: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
640: \] # ]
641: ) # initial subdomain
642: (?: #
643: (?: [\040\t] | \(
644: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
645: \) )* \. # if led by a period...
646: (?: [\040\t] | \(
647: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
648: \) )* (?:
649: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
650: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
651: | \[ # [
652: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
653: \] # ]
654: ) # ...further okay
655: )*
656: # address spec
657: (?: [\040\t] | \(
658: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
659: \) )* > # trailing >
660: # name and address
661: ) (?: [\040\t] | \(
662: (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] | \( (?: [^\\\x80-\xff\n\015()] | \\ [^\x80-\xff] )* \) )*
663: \) )* # optional trailing comment
664: /x
665: Alan Other <user\@dom.ain>
666: <user\@dom.ain>
667: user\@dom.ain
668: \"A. Other\" <user.1234\@dom.ain> (a comment)
669: A. Other <user.1234\@dom.ain> (a comment)
670: \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
671: A missing angle <user\@some.where
672: *** Failers
673: The quick brown fox
674:
675: /[\040\t]* # Nab whitespace.
676: (?:
677: \( # (
678: [^\\\x80-\xff\n\015()] * # normal*
679: (?: # (
680: (?: \\ [^\x80-\xff] |
681: \( # (
682: [^\\\x80-\xff\n\015()] * # normal*
683: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
684: \) # )
685: ) # special
686: [^\\\x80-\xff\n\015()] * # normal*
687: )* # )*
688: \) # )
689: [\040\t]* )* # If comment found, allow more spaces.
690: # optional leading comment
691: (?:
692: (?:
693: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
694: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
695: # Atom
696: | # or
697: " # "
698: [^\\\x80-\xff\n\015"] * # normal
699: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
700: " # "
701: # Quoted string
702: )
703: [\040\t]* # Nab whitespace.
704: (?:
705: \( # (
706: [^\\\x80-\xff\n\015()] * # normal*
707: (?: # (
708: (?: \\ [^\x80-\xff] |
709: \( # (
710: [^\\\x80-\xff\n\015()] * # normal*
711: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
712: \) # )
713: ) # special
714: [^\\\x80-\xff\n\015()] * # normal*
715: )* # )*
716: \) # )
717: [\040\t]* )* # If comment found, allow more spaces.
718: (?:
719: \.
720: [\040\t]* # Nab whitespace.
721: (?:
722: \( # (
723: [^\\\x80-\xff\n\015()] * # normal*
724: (?: # (
725: (?: \\ [^\x80-\xff] |
726: \( # (
727: [^\\\x80-\xff\n\015()] * # normal*
728: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
729: \) # )
730: ) # special
731: [^\\\x80-\xff\n\015()] * # normal*
732: )* # )*
733: \) # )
734: [\040\t]* )* # If comment found, allow more spaces.
735: (?:
736: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
737: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
738: # Atom
739: | # or
740: " # "
741: [^\\\x80-\xff\n\015"] * # normal
742: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
743: " # "
744: # Quoted string
745: )
746: [\040\t]* # Nab whitespace.
747: (?:
748: \( # (
749: [^\\\x80-\xff\n\015()] * # normal*
750: (?: # (
751: (?: \\ [^\x80-\xff] |
752: \( # (
753: [^\\\x80-\xff\n\015()] * # normal*
754: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
755: \) # )
756: ) # special
757: [^\\\x80-\xff\n\015()] * # normal*
758: )* # )*
759: \) # )
760: [\040\t]* )* # If comment found, allow more spaces.
761: # additional words
762: )*
763: @
764: [\040\t]* # Nab whitespace.
765: (?:
766: \( # (
767: [^\\\x80-\xff\n\015()] * # normal*
768: (?: # (
769: (?: \\ [^\x80-\xff] |
770: \( # (
771: [^\\\x80-\xff\n\015()] * # normal*
772: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
773: \) # )
774: ) # special
775: [^\\\x80-\xff\n\015()] * # normal*
776: )* # )*
777: \) # )
778: [\040\t]* )* # If comment found, allow more spaces.
779: (?:
780: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
781: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
782: |
783: \[ # [
784: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
785: \] # ]
786: )
787: [\040\t]* # Nab whitespace.
788: (?:
789: \( # (
790: [^\\\x80-\xff\n\015()] * # normal*
791: (?: # (
792: (?: \\ [^\x80-\xff] |
793: \( # (
794: [^\\\x80-\xff\n\015()] * # normal*
795: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
796: \) # )
797: ) # special
798: [^\\\x80-\xff\n\015()] * # normal*
799: )* # )*
800: \) # )
801: [\040\t]* )* # If comment found, allow more spaces.
802: # optional trailing comments
803: (?:
804: \.
805: [\040\t]* # Nab whitespace.
806: (?:
807: \( # (
808: [^\\\x80-\xff\n\015()] * # normal*
809: (?: # (
810: (?: \\ [^\x80-\xff] |
811: \( # (
812: [^\\\x80-\xff\n\015()] * # normal*
813: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
814: \) # )
815: ) # special
816: [^\\\x80-\xff\n\015()] * # normal*
817: )* # )*
818: \) # )
819: [\040\t]* )* # If comment found, allow more spaces.
820: (?:
821: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
822: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
823: |
824: \[ # [
825: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
826: \] # ]
827: )
828: [\040\t]* # Nab whitespace.
829: (?:
830: \( # (
831: [^\\\x80-\xff\n\015()] * # normal*
832: (?: # (
833: (?: \\ [^\x80-\xff] |
834: \( # (
835: [^\\\x80-\xff\n\015()] * # normal*
836: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
837: \) # )
838: ) # special
839: [^\\\x80-\xff\n\015()] * # normal*
840: )* # )*
841: \) # )
842: [\040\t]* )* # If comment found, allow more spaces.
843: # optional trailing comments
844: )*
845: # address
846: | # or
847: (?:
848: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
849: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
850: # Atom
851: | # or
852: " # "
853: [^\\\x80-\xff\n\015"] * # normal
854: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
855: " # "
856: # Quoted string
857: )
858: # leading word
859: [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # "normal" atoms and or spaces
860: (?:
861: (?:
862: \( # (
863: [^\\\x80-\xff\n\015()] * # normal*
864: (?: # (
865: (?: \\ [^\x80-\xff] |
866: \( # (
867: [^\\\x80-\xff\n\015()] * # normal*
868: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
869: \) # )
870: ) # special
871: [^\\\x80-\xff\n\015()] * # normal*
872: )* # )*
873: \) # )
874: |
875: " # "
876: [^\\\x80-\xff\n\015"] * # normal
877: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
878: " # "
879: ) # "special" comment or quoted string
880: [^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037] * # more "normal"
881: )*
882: <
883: [\040\t]* # Nab whitespace.
884: (?:
885: \( # (
886: [^\\\x80-\xff\n\015()] * # normal*
887: (?: # (
888: (?: \\ [^\x80-\xff] |
889: \( # (
890: [^\\\x80-\xff\n\015()] * # normal*
891: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
892: \) # )
893: ) # special
894: [^\\\x80-\xff\n\015()] * # normal*
895: )* # )*
896: \) # )
897: [\040\t]* )* # If comment found, allow more spaces.
898: # <
899: (?:
900: @
901: [\040\t]* # Nab whitespace.
902: (?:
903: \( # (
904: [^\\\x80-\xff\n\015()] * # normal*
905: (?: # (
906: (?: \\ [^\x80-\xff] |
907: \( # (
908: [^\\\x80-\xff\n\015()] * # normal*
909: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
910: \) # )
911: ) # special
912: [^\\\x80-\xff\n\015()] * # normal*
913: )* # )*
914: \) # )
915: [\040\t]* )* # If comment found, allow more spaces.
916: (?:
917: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
918: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
919: |
920: \[ # [
921: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
922: \] # ]
923: )
924: [\040\t]* # Nab whitespace.
925: (?:
926: \( # (
927: [^\\\x80-\xff\n\015()] * # normal*
928: (?: # (
929: (?: \\ [^\x80-\xff] |
930: \( # (
931: [^\\\x80-\xff\n\015()] * # normal*
932: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
933: \) # )
934: ) # special
935: [^\\\x80-\xff\n\015()] * # normal*
936: )* # )*
937: \) # )
938: [\040\t]* )* # If comment found, allow more spaces.
939: # optional trailing comments
940: (?:
941: \.
942: [\040\t]* # Nab whitespace.
943: (?:
944: \( # (
945: [^\\\x80-\xff\n\015()] * # normal*
946: (?: # (
947: (?: \\ [^\x80-\xff] |
948: \( # (
949: [^\\\x80-\xff\n\015()] * # normal*
950: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
951: \) # )
952: ) # special
953: [^\\\x80-\xff\n\015()] * # normal*
954: )* # )*
955: \) # )
956: [\040\t]* )* # If comment found, allow more spaces.
957: (?:
958: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
959: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
960: |
961: \[ # [
962: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
963: \] # ]
964: )
965: [\040\t]* # Nab whitespace.
966: (?:
967: \( # (
968: [^\\\x80-\xff\n\015()] * # normal*
969: (?: # (
970: (?: \\ [^\x80-\xff] |
971: \( # (
972: [^\\\x80-\xff\n\015()] * # normal*
973: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
974: \) # )
975: ) # special
976: [^\\\x80-\xff\n\015()] * # normal*
977: )* # )*
978: \) # )
979: [\040\t]* )* # If comment found, allow more spaces.
980: # optional trailing comments
981: )*
982: (?: ,
983: [\040\t]* # Nab whitespace.
984: (?:
985: \( # (
986: [^\\\x80-\xff\n\015()] * # normal*
987: (?: # (
988: (?: \\ [^\x80-\xff] |
989: \( # (
990: [^\\\x80-\xff\n\015()] * # normal*
991: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
992: \) # )
993: ) # special
994: [^\\\x80-\xff\n\015()] * # normal*
995: )* # )*
996: \) # )
997: [\040\t]* )* # If comment found, allow more spaces.
998: @
999: [\040\t]* # Nab whitespace.
1000: (?:
1001: \( # (
1002: [^\\\x80-\xff\n\015()] * # normal*
1003: (?: # (
1004: (?: \\ [^\x80-\xff] |
1005: \( # (
1006: [^\\\x80-\xff\n\015()] * # normal*
1007: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1008: \) # )
1009: ) # special
1010: [^\\\x80-\xff\n\015()] * # normal*
1011: )* # )*
1012: \) # )
1013: [\040\t]* )* # If comment found, allow more spaces.
1014: (?:
1015: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1016: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1017: |
1018: \[ # [
1019: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1020: \] # ]
1021: )
1022: [\040\t]* # Nab whitespace.
1023: (?:
1024: \( # (
1025: [^\\\x80-\xff\n\015()] * # normal*
1026: (?: # (
1027: (?: \\ [^\x80-\xff] |
1028: \( # (
1029: [^\\\x80-\xff\n\015()] * # normal*
1030: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1031: \) # )
1032: ) # special
1033: [^\\\x80-\xff\n\015()] * # normal*
1034: )* # )*
1035: \) # )
1036: [\040\t]* )* # If comment found, allow more spaces.
1037: # optional trailing comments
1038: (?:
1039: \.
1040: [\040\t]* # Nab whitespace.
1041: (?:
1042: \( # (
1043: [^\\\x80-\xff\n\015()] * # normal*
1044: (?: # (
1045: (?: \\ [^\x80-\xff] |
1046: \( # (
1047: [^\\\x80-\xff\n\015()] * # normal*
1048: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1049: \) # )
1050: ) # special
1051: [^\\\x80-\xff\n\015()] * # normal*
1052: )* # )*
1053: \) # )
1054: [\040\t]* )* # If comment found, allow more spaces.
1055: (?:
1056: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1057: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1058: |
1059: \[ # [
1060: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1061: \] # ]
1062: )
1063: [\040\t]* # Nab whitespace.
1064: (?:
1065: \( # (
1066: [^\\\x80-\xff\n\015()] * # normal*
1067: (?: # (
1068: (?: \\ [^\x80-\xff] |
1069: \( # (
1070: [^\\\x80-\xff\n\015()] * # normal*
1071: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1072: \) # )
1073: ) # special
1074: [^\\\x80-\xff\n\015()] * # normal*
1075: )* # )*
1076: \) # )
1077: [\040\t]* )* # If comment found, allow more spaces.
1078: # optional trailing comments
1079: )*
1080: )* # additional domains
1081: :
1082: [\040\t]* # Nab whitespace.
1083: (?:
1084: \( # (
1085: [^\\\x80-\xff\n\015()] * # normal*
1086: (?: # (
1087: (?: \\ [^\x80-\xff] |
1088: \( # (
1089: [^\\\x80-\xff\n\015()] * # normal*
1090: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1091: \) # )
1092: ) # special
1093: [^\\\x80-\xff\n\015()] * # normal*
1094: )* # )*
1095: \) # )
1096: [\040\t]* )* # If comment found, allow more spaces.
1097: # optional trailing comments
1098: )? # optional route
1099: (?:
1100: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1101: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1102: # Atom
1103: | # or
1104: " # "
1105: [^\\\x80-\xff\n\015"] * # normal
1106: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1107: " # "
1108: # Quoted string
1109: )
1110: [\040\t]* # Nab whitespace.
1111: (?:
1112: \( # (
1113: [^\\\x80-\xff\n\015()] * # normal*
1114: (?: # (
1115: (?: \\ [^\x80-\xff] |
1116: \( # (
1117: [^\\\x80-\xff\n\015()] * # normal*
1118: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1119: \) # )
1120: ) # special
1121: [^\\\x80-\xff\n\015()] * # normal*
1122: )* # )*
1123: \) # )
1124: [\040\t]* )* # If comment found, allow more spaces.
1125: (?:
1126: \.
1127: [\040\t]* # Nab whitespace.
1128: (?:
1129: \( # (
1130: [^\\\x80-\xff\n\015()] * # normal*
1131: (?: # (
1132: (?: \\ [^\x80-\xff] |
1133: \( # (
1134: [^\\\x80-\xff\n\015()] * # normal*
1135: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1136: \) # )
1137: ) # special
1138: [^\\\x80-\xff\n\015()] * # normal*
1139: )* # )*
1140: \) # )
1141: [\040\t]* )* # If comment found, allow more spaces.
1142: (?:
1143: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1144: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1145: # Atom
1146: | # or
1147: " # "
1148: [^\\\x80-\xff\n\015"] * # normal
1149: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015"] * )* # ( special normal* )*
1150: " # "
1151: # Quoted string
1152: )
1153: [\040\t]* # Nab whitespace.
1154: (?:
1155: \( # (
1156: [^\\\x80-\xff\n\015()] * # normal*
1157: (?: # (
1158: (?: \\ [^\x80-\xff] |
1159: \( # (
1160: [^\\\x80-\xff\n\015()] * # normal*
1161: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1162: \) # )
1163: ) # special
1164: [^\\\x80-\xff\n\015()] * # normal*
1165: )* # )*
1166: \) # )
1167: [\040\t]* )* # If comment found, allow more spaces.
1168: # additional words
1169: )*
1170: @
1171: [\040\t]* # Nab whitespace.
1172: (?:
1173: \( # (
1174: [^\\\x80-\xff\n\015()] * # normal*
1175: (?: # (
1176: (?: \\ [^\x80-\xff] |
1177: \( # (
1178: [^\\\x80-\xff\n\015()] * # normal*
1179: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1180: \) # )
1181: ) # special
1182: [^\\\x80-\xff\n\015()] * # normal*
1183: )* # )*
1184: \) # )
1185: [\040\t]* )* # If comment found, allow more spaces.
1186: (?:
1187: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1188: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1189: |
1190: \[ # [
1191: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1192: \] # ]
1193: )
1194: [\040\t]* # Nab whitespace.
1195: (?:
1196: \( # (
1197: [^\\\x80-\xff\n\015()] * # normal*
1198: (?: # (
1199: (?: \\ [^\x80-\xff] |
1200: \( # (
1201: [^\\\x80-\xff\n\015()] * # normal*
1202: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1203: \) # )
1204: ) # special
1205: [^\\\x80-\xff\n\015()] * # normal*
1206: )* # )*
1207: \) # )
1208: [\040\t]* )* # If comment found, allow more spaces.
1209: # optional trailing comments
1210: (?:
1211: \.
1212: [\040\t]* # Nab whitespace.
1213: (?:
1214: \( # (
1215: [^\\\x80-\xff\n\015()] * # normal*
1216: (?: # (
1217: (?: \\ [^\x80-\xff] |
1218: \( # (
1219: [^\\\x80-\xff\n\015()] * # normal*
1220: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1221: \) # )
1222: ) # special
1223: [^\\\x80-\xff\n\015()] * # normal*
1224: )* # )*
1225: \) # )
1226: [\040\t]* )* # If comment found, allow more spaces.
1227: (?:
1228: [^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+ # some number of atom characters...
1229: (?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]) # ..not followed by something that could be part of an atom
1230: |
1231: \[ # [
1232: (?: [^\\\x80-\xff\n\015\[\]] | \\ [^\x80-\xff] )* # stuff
1233: \] # ]
1234: )
1235: [\040\t]* # Nab whitespace.
1236: (?:
1237: \( # (
1238: [^\\\x80-\xff\n\015()] * # normal*
1239: (?: # (
1240: (?: \\ [^\x80-\xff] |
1241: \( # (
1242: [^\\\x80-\xff\n\015()] * # normal*
1243: (?: \\ [^\x80-\xff] [^\\\x80-\xff\n\015()] * )* # (special normal*)*
1244: \) # )
1245: ) # special
1246: [^\\\x80-\xff\n\015()] * # normal*
1247: )* # )*
1248: \) # )
1249: [\040\t]* )* # If comment found, allow more spaces.
1250: # optional trailing comments
1251: )*
1252: # address spec
1253: > # >
1254: # name and address
1255: )
1256: /x
1257: Alan Other <user\@dom.ain>
1258: <user\@dom.ain>
1259: user\@dom.ain
1260: \"A. Other\" <user.1234\@dom.ain> (a comment)
1261: A. Other <user.1234\@dom.ain> (a comment)
1262: \"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"\@x400-re.lay
1263: A missing angle <user\@some.where
1264: *** Failers
1265: The quick brown fox
1266:
1267: /abc\0def\00pqr\000xyz\0000AB/
1268: abc\0def\00pqr\000xyz\0000AB
1269: abc456 abc\0def\00pqr\000xyz\0000ABCDE
1270:
1271: /abc\x0def\x00pqr\x000xyz\x0000AB/
1272: abc\x0def\x00pqr\x000xyz\x0000AB
1273: abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE
1274:
1275: /^[\000-\037]/
1276: \0A
1277: \01B
1278: \037C
1279:
1280: /\0*/
1281: \0\0\0\0
1282:
1283: /A\x0{2,3}Z/
1284: The A\x0\x0Z
1285: An A\0\x0\0Z
1286: *** Failers
1287: A\0Z
1288: A\0\x0\0\x0Z
1289:
1290: /^(cow|)\1(bell)/
1291: cowcowbell
1292: bell
1293: *** Failers
1294: cowbell
1295:
1296: /^\s/
1297: \040abc
1298: \x0cabc
1299: \nabc
1300: \rabc
1301: \tabc
1302: *** Failers
1303: abc
1304:
1305: /^a b
1306: c/x
1307: abc
1308:
1309: /^(a|)\1*b/
1310: ab
1311: aaaab
1312: b
1313: *** Failers
1314: acb
1315:
1316: /^(a|)\1+b/
1317: aab
1318: aaaab
1319: b
1320: *** Failers
1321: ab
1322:
1323: /^(a|)\1?b/
1324: ab
1325: aab
1326: b
1327: *** Failers
1328: acb
1329:
1330: /^(a|)\1{2}b/
1331: aaab
1332: b
1333: *** Failers
1334: ab
1335: aab
1336: aaaab
1337:
1338: /^(a|)\1{2,3}b/
1339: aaab
1340: aaaab
1341: b
1342: *** Failers
1343: ab
1344: aab
1345: aaaaab
1346:
1347: /ab{1,3}bc/
1348: abbbbc
1349: abbbc
1350: abbc
1351: *** Failers
1352: abc
1353: abbbbbc
1354:
1355: /([^.]*)\.([^:]*):[T ]+(.*)/
1356: track1.title:TBlah blah blah
1357:
1358: /([^.]*)\.([^:]*):[T ]+(.*)/i
1359: track1.title:TBlah blah blah
1360:
1361: /([^.]*)\.([^:]*):[t ]+(.*)/i
1362: track1.title:TBlah blah blah
1363:
1364: /^[W-c]+$/
1365: WXY_^abc
1366: *** Failers
1367: wxy
1368:
1369: /^[W-c]+$/i
1370: WXY_^abc
1371: wxy_^ABC
1372:
1373: /^[\x3f-\x5F]+$/i
1374: WXY_^abc
1375: wxy_^ABC
1376:
1377: /^abc$/m
1378: abc
1379: qqq\nabc
1380: abc\nzzz
1381: qqq\nabc\nzzz
1382:
1383: /^abc$/
1384: abc
1385: *** Failers
1386: qqq\nabc
1387: abc\nzzz
1388: qqq\nabc\nzzz
1389:
1390: /\Aabc\Z/m
1391: abc
1392: abc\n
1393: *** Failers
1394: qqq\nabc
1395: abc\nzzz
1396: qqq\nabc\nzzz
1397:
1398: /\A(.)*\Z/s
1399: abc\ndef
1400:
1401: /\A(.)*\Z/m
1402: *** Failers
1403: abc\ndef
1404:
1405: /(?:b)|(?::+)/
1406: b::c
1407: c::b
1408:
1409: /[-az]+/
1410: az-
1411: *** Failers
1412: b
1413:
1414: /[az-]+/
1415: za-
1416: *** Failers
1417: b
1418:
1419: /[a\-z]+/
1420: a-z
1421: *** Failers
1422: b
1423:
1424: /[a-z]+/
1425: abcdxyz
1426:
1427: /[\d-]+/
1428: 12-34
1429: *** Failers
1430: aaa
1431:
1432: /[\d-z]+/
1433: 12-34z
1434: *** Failers
1435: aaa
1436:
1437: /\x5c/
1438: \\
1439:
1440: /\x20Z/
1441: the Zoo
1442: *** Failers
1443: Zulu
1444:
1445: /(abc)\1/i
1446: abcabc
1447: ABCabc
1448: abcABC
1449:
1450: /ab{3cd/
1451: ab{3cd
1452:
1453: /ab{3,cd/
1454: ab{3,cd
1455:
1456: /ab{3,4a}cd/
1457: ab{3,4a}cd
1458:
1459: /{4,5a}bc/
1460: {4,5a}bc
1461:
1462: /abc$/
1463: abc
1464: abc\n
1465: *** Failers
1466: abc\ndef
1467:
1468: /(abc)\123/
1469: abc\x53
1470:
1471: /(abc)\223/
1472: abc\x93
1473:
1474: /(abc)\323/
1475: abc\xd3
1476:
1477: /(abc)\100/
1478: abc\x40
1479: abc\100
1480:
1481: /(abc)\1000/
1482: abc\x400
1483: abc\x40\x30
1484: abc\1000
1485: abc\100\x30
1486: abc\100\060
1487: abc\100\60
1.1.1.5 ! misho 1488:
! 1489: /^A\8B\9C$/
! 1490: A8B9C
! 1491: *** Failers
! 1492: A\08B\09C
! 1493:
! 1494: /^(A)(B)(C)(D)(E)(F)(G)(H)(I)\8\9$/
! 1495: ABCDEFGHIHI
1.1 misho 1496:
1.1.1.5 ! misho 1497: /^[A\8B\9C]+$/
! 1498: A8B9C
! 1499: *** Failers
! 1500: A8B9C\x00
1.1 misho 1501:
1502: /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\12\123/
1503: abcdefghijkllS
1504:
1505: /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/
1506: abcdefghijk\12S
1507:
1508: /ab\idef/
1509: abidef
1510:
1511: /a{0}bc/
1512: bc
1513:
1514: /(a|(bc)){0,0}?xyz/
1515: xyz
1516:
1517: /abc[\10]de/
1518: abc\010de
1519:
1520: /abc[\1]de/
1521: abc\1de
1522:
1523: /(abc)[\1]de/
1524: abc\1de
1525:
1526: /(?s)a.b/
1527: a\nb
1528:
1529: /^([^a])([^\b])([^c]*)([^d]{3,4})/
1530: baNOTccccd
1531: baNOTcccd
1532: baNOTccd
1533: bacccd
1534: *** Failers
1535: anything
1536: b\bc
1537: baccd
1538:
1539: /[^a]/
1540: Abc
1541:
1542: /[^a]/i
1543: Abc
1544:
1545: /[^a]+/
1546: AAAaAbc
1547:
1548: /[^a]+/i
1549: AAAaAbc
1550:
1551: /[^a]+/
1552: bbb\nccc
1553:
1554: /[^k]$/
1555: abc
1556: *** Failers
1557: abk
1558:
1559: /[^k]{2,3}$/
1560: abc
1561: kbc
1562: kabc
1563: *** Failers
1564: abk
1565: akb
1566: akk
1567:
1568: /^\d{8,}\@.+[^k]$/
1569: 12345678\@a.b.c.d
1570: 123456789\@x.y.z
1571: *** Failers
1572: 12345678\@x.y.uk
1573: 1234567\@a.b.c.d
1574:
1575: /(a)\1{8,}/
1576: aaaaaaaaa
1577: aaaaaaaaaa
1578: *** Failers
1579: aaaaaaa
1580:
1581: /[^a]/
1582: aaaabcd
1583: aaAabcd
1584:
1585: /[^a]/i
1586: aaaabcd
1587: aaAabcd
1588:
1589: /[^az]/
1590: aaaabcd
1591: aaAabcd
1592:
1593: /[^az]/i
1594: aaaabcd
1595: aaAabcd
1596:
1597: /\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/
1598: \000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377
1599:
1600: /P[^*]TAIRE[^*]{1,6}?LL/
1601: xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
1602:
1603: /P[^*]TAIRE[^*]{1,}?LL/
1604: xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
1605:
1606: /(\.\d\d[1-9]?)\d+/
1607: 1.230003938
1608: 1.875000282
1609: 1.235
1610:
1611: /(\.\d\d((?=0)|\d(?=\d)))/
1612: 1.230003938
1613: 1.875000282
1614: *** Failers
1615: 1.235
1616:
1617: /a(?)b/
1618: ab
1619:
1620: /\b(foo)\s+(\w+)/i
1621: Food is on the foo table
1622:
1623: /foo(.*)bar/
1624: The food is under the bar in the barn.
1625:
1626: /foo(.*?)bar/
1627: The food is under the bar in the barn.
1628:
1629: /(.*)(\d*)/
1630: I have 2 numbers: 53147
1631:
1632: /(.*)(\d+)/
1633: I have 2 numbers: 53147
1634:
1635: /(.*?)(\d*)/
1636: I have 2 numbers: 53147
1637:
1638: /(.*?)(\d+)/
1639: I have 2 numbers: 53147
1640:
1641: /(.*)(\d+)$/
1642: I have 2 numbers: 53147
1643:
1644: /(.*?)(\d+)$/
1645: I have 2 numbers: 53147
1646:
1647: /(.*)\b(\d+)$/
1648: I have 2 numbers: 53147
1649:
1650: /(.*\D)(\d+)$/
1651: I have 2 numbers: 53147
1652:
1653: /^\D*(?!123)/
1654: ABC123
1655:
1656: /^(\D*)(?=\d)(?!123)/
1657: ABC445
1658: *** Failers
1659: ABC123
1660:
1661: /^[W-]46]/
1662: W46]789
1663: -46]789
1664: *** Failers
1665: Wall
1666: Zebra
1667: 42
1668: [abcd]
1669: ]abcd[
1670:
1671: /^[W-\]46]/
1672: W46]789
1673: Wall
1674: Zebra
1675: Xylophone
1676: 42
1677: [abcd]
1678: ]abcd[
1679: \\backslash
1680: *** Failers
1681: -46]789
1682: well
1683:
1684: /\d\d\/\d\d\/\d\d\d\d/
1685: 01/01/2000
1686:
1687: /word (?:[a-zA-Z0-9]+ ){0,10}otherword/
1688: word cat dog elephant mussel cow horse canary baboon snake shark otherword
1689: word cat dog elephant mussel cow horse canary baboon snake shark
1690:
1691: /word (?:[a-zA-Z0-9]+ ){0,300}otherword/
1692: word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
1693:
1694: /^(a){0,0}/
1695: bcd
1696: abc
1697: aab
1698:
1699: /^(a){0,1}/
1700: bcd
1701: abc
1702: aab
1703:
1704: /^(a){0,2}/
1705: bcd
1706: abc
1707: aab
1708:
1709: /^(a){0,3}/
1710: bcd
1711: abc
1712: aab
1713: aaa
1714:
1715: /^(a){0,}/
1716: bcd
1717: abc
1718: aab
1719: aaa
1720: aaaaaaaa
1721:
1722: /^(a){1,1}/
1723: bcd
1724: abc
1725: aab
1726:
1727: /^(a){1,2}/
1728: bcd
1729: abc
1730: aab
1731:
1732: /^(a){1,3}/
1733: bcd
1734: abc
1735: aab
1736: aaa
1737:
1738: /^(a){1,}/
1739: bcd
1740: abc
1741: aab
1742: aaa
1743: aaaaaaaa
1744:
1745: /.*\.gif/
1746: borfle\nbib.gif\nno
1747:
1748: /.{0,}\.gif/
1749: borfle\nbib.gif\nno
1750:
1751: /.*\.gif/m
1752: borfle\nbib.gif\nno
1753:
1754: /.*\.gif/s
1755: borfle\nbib.gif\nno
1756:
1757: /.*\.gif/ms
1758: borfle\nbib.gif\nno
1759:
1760: /.*$/
1761: borfle\nbib.gif\nno
1762:
1763: /.*$/m
1764: borfle\nbib.gif\nno
1765:
1766: /.*$/s
1767: borfle\nbib.gif\nno
1768:
1769: /.*$/ms
1770: borfle\nbib.gif\nno
1771:
1772: /.*$/
1773: borfle\nbib.gif\nno\n
1774:
1775: /.*$/m
1776: borfle\nbib.gif\nno\n
1777:
1778: /.*$/s
1779: borfle\nbib.gif\nno\n
1780:
1781: /.*$/ms
1782: borfle\nbib.gif\nno\n
1783:
1784: /(.*X|^B)/
1785: abcde\n1234Xyz
1786: BarFoo
1787: *** Failers
1788: abcde\nBar
1789:
1790: /(.*X|^B)/m
1791: abcde\n1234Xyz
1792: BarFoo
1793: abcde\nBar
1794:
1795: /(.*X|^B)/s
1796: abcde\n1234Xyz
1797: BarFoo
1798: *** Failers
1799: abcde\nBar
1800:
1801: /(.*X|^B)/ms
1802: abcde\n1234Xyz
1803: BarFoo
1804: abcde\nBar
1805:
1806: /(?s)(.*X|^B)/
1807: abcde\n1234Xyz
1808: BarFoo
1809: *** Failers
1810: abcde\nBar
1811:
1812: /(?s:.*X|^B)/
1813: abcde\n1234Xyz
1814: BarFoo
1815: *** Failers
1816: abcde\nBar
1817:
1818: /^.*B/
1819: **** Failers
1820: abc\nB
1821:
1822: /(?s)^.*B/
1823: abc\nB
1824:
1825: /(?m)^.*B/
1826: abc\nB
1827:
1828: /(?ms)^.*B/
1829: abc\nB
1830:
1831: /(?ms)^B/
1832: abc\nB
1833:
1834: /(?s)B$/
1835: B\n
1836:
1837: /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
1838: 123456654321
1839:
1840: /^\d\d\d\d\d\d\d\d\d\d\d\d/
1841: 123456654321
1842:
1843: /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/
1844: 123456654321
1845:
1846: /^[abc]{12}/
1847: abcabcabcabc
1848:
1849: /^[a-c]{12}/
1850: abcabcabcabc
1851:
1852: /^(a|b|c){12}/
1853: abcabcabcabc
1854:
1855: /^[abcdefghijklmnopqrstuvwxy0123456789]/
1856: n
1857: *** Failers
1858: z
1859:
1860: /abcde{0,0}/
1861: abcd
1862: *** Failers
1863: abce
1864:
1865: /ab[cd]{0,0}e/
1866: abe
1867: *** Failers
1868: abcde
1869:
1870: /ab(c){0,0}d/
1871: abd
1872: *** Failers
1873: abcd
1874:
1875: /a(b*)/
1876: a
1877: ab
1878: abbbb
1879: *** Failers
1880: bbbbb
1881:
1882: /ab\d{0}e/
1883: abe
1884: *** Failers
1885: ab1e
1886:
1887: /"([^\\"]+|\\.)*"/
1888: the \"quick\" brown fox
1889: \"the \\\"quick\\\" brown fox\"
1890:
1891: /.*?/g+
1892: abc
1893:
1894: /\b/g+
1895: abc
1896:
1897: /\b/+g
1898: abc
1899:
1900: //g
1901: abc
1902:
1903: /<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/is
1904: <TR BGCOLOR='#DBE9E9'><TD align=left valign=top>43.<a href='joblist.cfm?JobID=94 6735&Keyword='>Word Processor<BR>(N-1286)</a></TD><TD align=left valign=top>Lega lstaff.com</TD><TD align=left valign=top>CA - Statewide</TD></TR>
1905:
1906: /a[^a]b/
1907: acb
1908: a\nb
1909:
1910: /a.b/
1911: acb
1912: *** Failers
1913: a\nb
1914:
1915: /a[^a]b/s
1916: acb
1917: a\nb
1918:
1919: /a.b/s
1920: acb
1921: a\nb
1922:
1923: /^(b+?|a){1,2}?c/
1924: bac
1925: bbac
1926: bbbac
1927: bbbbac
1928: bbbbbac
1929:
1930: /^(b+|a){1,2}?c/
1931: bac
1932: bbac
1933: bbbac
1934: bbbbac
1935: bbbbbac
1936:
1937: /(?!\A)x/m
1938: x\nb\n
1939: a\bx\n
1940:
1941: /\x0{ab}/
1942: \0{ab}
1943:
1944: /(A|B)*?CD/
1945: CD
1946:
1947: /(A|B)*CD/
1948: CD
1949:
1950: /(AB)*?\1/
1951: ABABAB
1952:
1953: /(AB)*\1/
1954: ABABAB
1955:
1956: /(?<!bar)foo/
1957: foo
1958: catfood
1959: arfootle
1960: rfoosh
1961: *** Failers
1962: barfoo
1963: towbarfoo
1964:
1965: /\w{3}(?<!bar)foo/
1966: catfood
1967: *** Failers
1968: foo
1969: barfoo
1970: towbarfoo
1971:
1972: /(?<=(foo)a)bar/
1973: fooabar
1974: *** Failers
1975: bar
1976: foobbar
1977:
1978: /\Aabc\z/m
1979: abc
1980: *** Failers
1981: abc\n
1982: qqq\nabc
1983: abc\nzzz
1984: qqq\nabc\nzzz
1985:
1986: "(?>.*/)foo"
1987: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/
1988:
1989: "(?>.*/)foo"
1990: /this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo
1991:
1992: /(?>(\.\d\d[1-9]?))\d+/
1993: 1.230003938
1994: 1.875000282
1995: *** Failers
1996: 1.235
1997:
1998: /^((?>\w+)|(?>\s+))*$/
1999: now is the time for all good men to come to the aid of the party
2000: *** Failers
2001: this is not a line with only words and spaces!
2002:
2003: /(\d+)(\w)/
2004: 12345a
2005: 12345+
2006:
2007: /((?>\d+))(\w)/
2008: 12345a
2009: *** Failers
2010: 12345+
2011:
2012: /(?>a+)b/
2013: aaab
2014:
2015: /((?>a+)b)/
2016: aaab
2017:
2018: /(?>(a+))b/
2019: aaab
2020:
2021: /(?>b)+/
2022: aaabbbccc
2023:
2024: /(?>a+|b+|c+)*c/
2025: aaabbbbccccd
2026:
2027: /((?>[^()]+)|\([^()]*\))+/
2028: ((abc(ade)ufh()()x
2029:
2030: /\(((?>[^()]+)|\([^()]+\))+\)/
2031: (abc)
2032: (abc(def)xyz)
2033: *** Failers
2034: ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
2035:
2036: /a(?-i)b/i
2037: ab
2038: Ab
2039: *** Failers
2040: aB
2041: AB
2042:
2043: /(a (?x)b c)d e/
2044: a bcd e
2045: *** Failers
2046: a b cd e
2047: abcd e
2048: a bcde
2049:
2050: /(a b(?x)c d (?-x)e f)/
2051: a bcde f
2052: *** Failers
2053: abcdef
2054:
2055: /(a(?i)b)c/
2056: abc
2057: aBc
2058: *** Failers
2059: abC
2060: aBC
2061: Abc
2062: ABc
2063: ABC
2064: AbC
2065:
2066: /a(?i:b)c/
2067: abc
2068: aBc
2069: *** Failers
2070: ABC
2071: abC
2072: aBC
2073:
2074: /a(?i:b)*c/
2075: aBc
2076: aBBc
2077: *** Failers
2078: aBC
2079: aBBC
2080:
2081: /a(?=b(?i)c)\w\wd/
2082: abcd
2083: abCd
2084: *** Failers
2085: aBCd
2086: abcD
2087:
2088: /(?s-i:more.*than).*million/i
2089: more than million
2090: more than MILLION
2091: more \n than Million
2092: *** Failers
2093: MORE THAN MILLION
2094: more \n than \n million
2095:
2096: /(?:(?s-i)more.*than).*million/i
2097: more than million
2098: more than MILLION
2099: more \n than Million
2100: *** Failers
2101: MORE THAN MILLION
2102: more \n than \n million
2103:
2104: /(?>a(?i)b+)+c/
2105: abc
2106: aBbc
2107: aBBc
2108: *** Failers
2109: Abc
2110: abAb
2111: abbC
2112:
2113: /(?=a(?i)b)\w\wc/
2114: abc
2115: aBc
2116: *** Failers
2117: Ab
2118: abC
2119: aBC
2120:
2121: /(?<=a(?i)b)(\w\w)c/
2122: abxxc
2123: aBxxc
2124: *** Failers
2125: Abxxc
2126: ABxxc
2127: abxxC
2128:
2129: /(?:(a)|b)(?(1)A|B)/
2130: aA
2131: bB
2132: *** Failers
2133: aB
2134: bA
2135:
2136: /^(a)?(?(1)a|b)+$/
2137: aa
2138: b
2139: bb
2140: *** Failers
2141: ab
2142:
2143: /^(?(?=abc)\w{3}:|\d\d)$/
2144: abc:
2145: 12
2146: *** Failers
2147: 123
2148: xyz
2149:
2150: /^(?(?!abc)\d\d|\w{3}:)$/
2151: abc:
2152: 12
2153: *** Failers
2154: 123
2155: xyz
2156:
2157: /(?(?<=foo)bar|cat)/
2158: foobar
2159: cat
2160: fcat
2161: focat
2162: *** Failers
2163: foocat
2164:
2165: /(?(?<!foo)cat|bar)/
2166: foobar
2167: cat
2168: fcat
2169: focat
2170: *** Failers
2171: foocat
2172:
2173: /( \( )? [^()]+ (?(1) \) |) /x
2174: abcd
2175: (abcd)
2176: the quick (abcd) fox
2177: (abcd
2178:
2179: /( \( )? [^()]+ (?(1) \) ) /x
2180: abcd
2181: (abcd)
2182: the quick (abcd) fox
2183: (abcd
2184:
2185: /^(?(2)a|(1)(2))+$/
2186: 12
2187: 12a
2188: 12aa
2189: *** Failers
2190: 1234
2191:
2192: /((?i)blah)\s+\1/
2193: blah blah
2194: BLAH BLAH
2195: Blah Blah
2196: blaH blaH
2197: *** Failers
2198: blah BLAH
2199: Blah blah
2200: blaH blah
2201:
2202: /((?i)blah)\s+(?i:\1)/
2203: blah blah
2204: BLAH BLAH
2205: Blah Blah
2206: blaH blaH
2207: blah BLAH
2208: Blah blah
2209: blaH blah
2210:
2211: /(?>a*)*/
2212: a
2213: aa
2214: aaaa
2215:
2216: /(abc|)+/
2217: abc
2218: abcabc
2219: abcabcabc
2220: xyz
2221:
2222: /([a]*)*/
2223: a
2224: aaaaa
2225:
2226: /([ab]*)*/
2227: a
2228: b
2229: ababab
2230: aaaabcde
2231: bbbb
2232:
2233: /([^a]*)*/
2234: b
2235: bbbb
2236: aaa
2237:
2238: /([^ab]*)*/
2239: cccc
2240: abab
2241:
2242: /([a]*?)*/
2243: a
2244: aaaa
2245:
2246: /([ab]*?)*/
2247: a
2248: b
2249: abab
2250: baba
2251:
2252: /([^a]*?)*/
2253: b
2254: bbbb
2255: aaa
2256:
2257: /([^ab]*?)*/
2258: c
2259: cccc
2260: baba
2261:
2262: /(?>a*)*/
2263: a
2264: aaabcde
2265:
2266: /((?>a*))*/
2267: aaaaa
2268: aabbaa
2269:
2270: /((?>a*?))*/
2271: aaaaa
2272: aabbaa
2273:
2274: /(?(?=[^a-z]+[a-z]) \d{2}-[a-z]{3}-\d{2} | \d{2}-\d{2}-\d{2} ) /x
2275: 12-sep-98
2276: 12-09-98
2277: *** Failers
2278: sep-12-98
2279:
2280: /(?<=(foo))bar\1/
2281: foobarfoo
2282: foobarfootling
2283: *** Failers
2284: foobar
2285: barfoo
2286:
2287: /(?i:saturday|sunday)/
2288: saturday
2289: sunday
2290: Saturday
2291: Sunday
2292: SATURDAY
2293: SUNDAY
2294: SunDay
2295:
2296: /(a(?i)bc|BB)x/
2297: abcx
2298: aBCx
2299: bbx
2300: BBx
2301: *** Failers
2302: abcX
2303: aBCX
2304: bbX
2305: BBX
2306:
2307: /^([ab](?i)[cd]|[ef])/
2308: ac
2309: aC
2310: bD
2311: elephant
2312: Europe
2313: frog
2314: France
2315: *** Failers
2316: Africa
2317:
2318: /^(ab|a(?i)[b-c](?m-i)d|x(?i)y|z)/
2319: ab
2320: aBd
2321: xy
2322: xY
2323: zebra
2324: Zambesi
2325: *** Failers
2326: aCD
2327: XY
2328:
2329: /(?<=foo\n)^bar/m
2330: foo\nbar
2331: *** Failers
2332: bar
2333: baz\nbar
2334:
2335: /(?<=(?<!foo)bar)baz/
2336: barbaz
2337: barbarbaz
2338: koobarbaz
2339: *** Failers
2340: baz
2341: foobarbaz
2342:
2343: /The cases of aaaa and aaaaaa are missed out below because Perl does things/
2344: /differently. We know that odd, and maybe incorrect, things happen with/
2345: /recursive references in Perl, as far as 5.11.3 - see some stuff in test #2./
2346:
2347: /^(a\1?){4}$/
2348: a
2349: aa
2350: aaa
2351: aaaaa
2352: aaaaaaa
2353: aaaaaaaa
2354: aaaaaaaaa
2355: aaaaaaaaaa
2356: aaaaaaaaaaa
2357: aaaaaaaaaaaa
2358: aaaaaaaaaaaaa
2359: aaaaaaaaaaaaaa
2360: aaaaaaaaaaaaaaa
2361: aaaaaaaaaaaaaaaa
2362:
2363: /^(a\1?)(a\1?)(a\2?)(a\3?)$/
2364: a
2365: aa
2366: aaa
2367: aaaa
2368: aaaaa
2369: aaaaaa
2370: aaaaaaa
2371: aaaaaaaa
2372: aaaaaaaaa
2373: aaaaaaaaaa
2374: aaaaaaaaaaa
2375: aaaaaaaaaaaa
2376: aaaaaaaaaaaaa
2377: aaaaaaaaaaaaaa
2378: aaaaaaaaaaaaaaa
2379: aaaaaaaaaaaaaaaa
2380:
2381: /The following tests are taken from the Perl 5.005 test suite; some of them/
2382: /are compatible with 5.004, but I'd rather not have to sort them out./
2383:
2384: /abc/
2385: abc
2386: xabcy
2387: ababc
2388: *** Failers
2389: xbc
2390: axc
2391: abx
2392:
2393: /ab*c/
2394: abc
2395:
2396: /ab*bc/
2397: abc
2398: abbc
2399: abbbbc
2400:
2401: /.{1}/
2402: abbbbc
2403:
2404: /.{3,4}/
2405: abbbbc
2406:
2407: /ab{0,}bc/
2408: abbbbc
2409:
2410: /ab+bc/
2411: abbc
2412: *** Failers
2413: abc
2414: abq
2415:
2416: /ab{1,}bc/
2417:
2418: /ab+bc/
2419: abbbbc
2420:
2421: /ab{1,}bc/
2422: abbbbc
2423:
2424: /ab{1,3}bc/
2425: abbbbc
2426:
2427: /ab{3,4}bc/
2428: abbbbc
2429:
2430: /ab{4,5}bc/
2431: *** Failers
2432: abq
2433: abbbbc
2434:
2435: /ab?bc/
2436: abbc
2437: abc
2438:
2439: /ab{0,1}bc/
2440: abc
2441:
2442: /ab?bc/
2443:
2444: /ab?c/
2445: abc
2446:
2447: /ab{0,1}c/
2448: abc
2449:
2450: /^abc$/
2451: abc
2452: *** Failers
2453: abbbbc
2454: abcc
2455:
2456: /^abc/
2457: abcc
2458:
2459: /^abc$/
2460:
2461: /abc$/
2462: aabc
2463: *** Failers
2464: aabc
2465: aabcd
2466:
2467: /^/
2468: abc
2469:
2470: /$/
2471: abc
2472:
2473: /a.c/
2474: abc
2475: axc
2476:
2477: /a.*c/
2478: axyzc
2479:
2480: /a[bc]d/
2481: abd
2482: *** Failers
2483: axyzd
2484: abc
2485:
2486: /a[b-d]e/
2487: ace
2488:
2489: /a[b-d]/
2490: aac
2491:
2492: /a[-b]/
2493: a-
2494:
2495: /a[b-]/
2496: a-
2497:
2498: /a]/
2499: a]
2500:
2501: /a[]]b/
2502: a]b
2503:
2504: /a[^bc]d/
2505: aed
2506: *** Failers
2507: abd
2508: abd
2509:
2510: /a[^-b]c/
2511: adc
2512:
2513: /a[^]b]c/
2514: adc
2515: *** Failers
2516: a-c
2517: a]c
2518:
2519: /\ba\b/
2520: a-
2521: -a
2522: -a-
2523:
2524: /\by\b/
2525: *** Failers
2526: xy
2527: yz
2528: xyz
2529:
2530: /\Ba\B/
2531: *** Failers
2532: a-
2533: -a
2534: -a-
2535:
2536: /\By\b/
2537: xy
2538:
2539: /\by\B/
2540: yz
2541:
2542: /\By\B/
2543: xyz
2544:
2545: /\w/
2546: a
2547:
2548: /\W/
2549: -
2550: *** Failers
2551: -
2552: a
2553:
2554: /a\sb/
2555: a b
2556:
2557: /a\Sb/
2558: a-b
2559: *** Failers
2560: a-b
2561: a b
2562:
2563: /\d/
2564: 1
2565:
2566: /\D/
2567: -
2568: *** Failers
2569: -
2570: 1
2571:
2572: /[\w]/
2573: a
2574:
2575: /[\W]/
2576: -
2577: *** Failers
2578: -
2579: a
2580:
2581: /a[\s]b/
2582: a b
2583:
2584: /a[\S]b/
2585: a-b
2586: *** Failers
2587: a-b
2588: a b
2589:
2590: /[\d]/
2591: 1
2592:
2593: /[\D]/
2594: -
2595: *** Failers
2596: -
2597: 1
2598:
2599: /ab|cd/
2600: abc
2601: abcd
2602:
2603: /()ef/
2604: def
2605:
2606: /$b/
2607:
2608: /a\(b/
2609: a(b
2610:
2611: /a\(*b/
2612: ab
2613: a((b
2614:
2615: /a\\b/
2616: a\b
2617:
2618: /((a))/
2619: abc
2620:
2621: /(a)b(c)/
2622: abc
2623:
2624: /a+b+c/
2625: aabbabc
2626:
2627: /a{1,}b{1,}c/
2628: aabbabc
2629:
2630: /a.+?c/
2631: abcabc
2632:
2633: /(a+|b)*/
2634: ab
2635:
2636: /(a+|b){0,}/
2637: ab
2638:
2639: /(a+|b)+/
2640: ab
2641:
2642: /(a+|b){1,}/
2643: ab
2644:
2645: /(a+|b)?/
2646: ab
2647:
2648: /(a+|b){0,1}/
2649: ab
2650:
2651: /[^ab]*/
2652: cde
2653:
2654: /abc/
2655: *** Failers
2656: b
2657:
2658:
2659: /a*/
2660:
2661:
2662: /([abc])*d/
2663: abbbcd
2664:
2665: /([abc])*bcd/
2666: abcd
2667:
2668: /a|b|c|d|e/
2669: e
2670:
2671: /(a|b|c|d|e)f/
2672: ef
2673:
2674: /abcd*efg/
2675: abcdefg
2676:
2677: /ab*/
2678: xabyabbbz
2679: xayabbbz
2680:
2681: /(ab|cd)e/
2682: abcde
2683:
2684: /[abhgefdc]ij/
2685: hij
2686:
2687: /^(ab|cd)e/
2688:
2689: /(abc|)ef/
2690: abcdef
2691:
2692: /(a|b)c*d/
2693: abcd
2694:
2695: /(ab|ab*)bc/
2696: abc
2697:
2698: /a([bc]*)c*/
2699: abc
2700:
2701: /a([bc]*)(c*d)/
2702: abcd
2703:
2704: /a([bc]+)(c*d)/
2705: abcd
2706:
2707: /a([bc]*)(c+d)/
2708: abcd
2709:
2710: /a[bcd]*dcdcde/
2711: adcdcde
2712:
2713: /a[bcd]+dcdcde/
2714: *** Failers
2715: abcde
2716: adcdcde
2717:
2718: /(ab|a)b*c/
2719: abc
2720:
2721: /((a)(b)c)(d)/
2722: abcd
2723:
2724: /[a-zA-Z_][a-zA-Z0-9_]*/
2725: alpha
2726:
2727: /^a(bc+|b[eh])g|.h$/
2728: abh
2729:
2730: /(bc+d$|ef*g.|h?i(j|k))/
2731: effgz
2732: ij
2733: reffgz
2734: *** Failers
2735: effg
2736: bcdd
2737:
2738: /((((((((((a))))))))))/
2739: a
2740:
2741: /((((((((((a))))))))))\10/
2742: aa
2743:
2744: /(((((((((a)))))))))/
2745: a
2746:
2747: /multiple words of text/
2748: *** Failers
2749: aa
2750: uh-uh
2751:
2752: /multiple words/
2753: multiple words, yeah
2754:
2755: /(.*)c(.*)/
2756: abcde
2757:
2758: /\((.*), (.*)\)/
2759: (a, b)
2760:
2761: /[k]/
2762:
2763: /abcd/
2764: abcd
2765:
2766: /a(bc)d/
2767: abcd
2768:
2769: /a[-]?c/
2770: ac
2771:
2772: /(abc)\1/
2773: abcabc
2774:
2775: /([a-c]*)\1/
2776: abcabc
2777:
2778: /(a)|\1/
2779: a
2780: *** Failers
2781: ab
2782: x
2783:
2784: /(([a-c])b*?\2)*/
2785: ababbbcbc
2786:
2787: /(([a-c])b*?\2){3}/
2788: ababbbcbc
2789:
2790: /((\3|b)\2(a)x)+/
2791: aaaxabaxbaaxbbax
2792:
2793: /((\3|b)\2(a)){2,}/
2794: bbaababbabaaaaabbaaaabba
2795:
2796: /abc/i
2797: ABC
2798: XABCY
2799: ABABC
2800: *** Failers
2801: aaxabxbaxbbx
2802: XBC
2803: AXC
2804: ABX
2805:
2806: /ab*c/i
2807: ABC
2808:
2809: /ab*bc/i
2810: ABC
2811: ABBC
2812:
2813: /ab*?bc/i
2814: ABBBBC
2815:
2816: /ab{0,}?bc/i
2817: ABBBBC
2818:
2819: /ab+?bc/i
2820: ABBC
2821:
2822: /ab+bc/i
2823: *** Failers
2824: ABC
2825: ABQ
2826:
2827: /ab{1,}bc/i
2828:
2829: /ab+bc/i
2830: ABBBBC
2831:
2832: /ab{1,}?bc/i
2833: ABBBBC
2834:
2835: /ab{1,3}?bc/i
2836: ABBBBC
2837:
2838: /ab{3,4}?bc/i
2839: ABBBBC
2840:
2841: /ab{4,5}?bc/i
2842: *** Failers
2843: ABQ
2844: ABBBBC
2845:
2846: /ab??bc/i
2847: ABBC
2848: ABC
2849:
2850: /ab{0,1}?bc/i
2851: ABC
2852:
2853: /ab??bc/i
2854:
2855: /ab??c/i
2856: ABC
2857:
2858: /ab{0,1}?c/i
2859: ABC
2860:
2861: /^abc$/i
2862: ABC
2863: *** Failers
2864: ABBBBC
2865: ABCC
2866:
2867: /^abc/i
2868: ABCC
2869:
2870: /^abc$/i
2871:
2872: /abc$/i
2873: AABC
2874:
2875: /^/i
2876: ABC
2877:
2878: /$/i
2879: ABC
2880:
2881: /a.c/i
2882: ABC
2883: AXC
2884:
2885: /a.*?c/i
2886: AXYZC
2887:
2888: /a.*c/i
2889: *** Failers
2890: AABC
2891: AXYZD
2892:
2893: /a[bc]d/i
2894: ABD
2895:
2896: /a[b-d]e/i
2897: ACE
2898: *** Failers
2899: ABC
2900: ABD
2901:
2902: /a[b-d]/i
2903: AAC
2904:
2905: /a[-b]/i
2906: A-
2907:
2908: /a[b-]/i
2909: A-
2910:
2911: /a]/i
2912: A]
2913:
2914: /a[]]b/i
2915: A]B
2916:
2917: /a[^bc]d/i
2918: AED
2919:
2920: /a[^-b]c/i
2921: ADC
2922: *** Failers
2923: ABD
2924: A-C
2925:
2926: /a[^]b]c/i
2927: ADC
2928:
2929: /ab|cd/i
2930: ABC
2931: ABCD
2932:
2933: /()ef/i
2934: DEF
2935:
2936: /$b/i
2937: *** Failers
2938: A]C
2939: B
2940:
2941: /a\(b/i
2942: A(B
2943:
2944: /a\(*b/i
2945: AB
2946: A((B
2947:
2948: /a\\b/i
2949: A\B
2950:
2951: /((a))/i
2952: ABC
2953:
2954: /(a)b(c)/i
2955: ABC
2956:
2957: /a+b+c/i
2958: AABBABC
2959:
2960: /a{1,}b{1,}c/i
2961: AABBABC
2962:
2963: /a.+?c/i
2964: ABCABC
2965:
2966: /a.*?c/i
2967: ABCABC
2968:
2969: /a.{0,5}?c/i
2970: ABCABC
2971:
2972: /(a+|b)*/i
2973: AB
2974:
2975: /(a+|b){0,}/i
2976: AB
2977:
2978: /(a+|b)+/i
2979: AB
2980:
2981: /(a+|b){1,}/i
2982: AB
2983:
2984: /(a+|b)?/i
2985: AB
2986:
2987: /(a+|b){0,1}/i
2988: AB
2989:
2990: /(a+|b){0,1}?/i
2991: AB
2992:
2993: /[^ab]*/i
2994: CDE
2995:
2996: /abc/i
2997:
2998: /a*/i
2999:
3000:
3001: /([abc])*d/i
3002: ABBBCD
3003:
3004: /([abc])*bcd/i
3005: ABCD
3006:
3007: /a|b|c|d|e/i
3008: E
3009:
3010: /(a|b|c|d|e)f/i
3011: EF
3012:
3013: /abcd*efg/i
3014: ABCDEFG
3015:
3016: /ab*/i
3017: XABYABBBZ
3018: XAYABBBZ
3019:
3020: /(ab|cd)e/i
3021: ABCDE
3022:
3023: /[abhgefdc]ij/i
3024: HIJ
3025:
3026: /^(ab|cd)e/i
3027: ABCDE
3028:
3029: /(abc|)ef/i
3030: ABCDEF
3031:
3032: /(a|b)c*d/i
3033: ABCD
3034:
3035: /(ab|ab*)bc/i
3036: ABC
3037:
3038: /a([bc]*)c*/i
3039: ABC
3040:
3041: /a([bc]*)(c*d)/i
3042: ABCD
3043:
3044: /a([bc]+)(c*d)/i
3045: ABCD
3046:
3047: /a([bc]*)(c+d)/i
3048: ABCD
3049:
3050: /a[bcd]*dcdcde/i
3051: ADCDCDE
3052:
3053: /a[bcd]+dcdcde/i
3054:
3055: /(ab|a)b*c/i
3056: ABC
3057:
3058: /((a)(b)c)(d)/i
3059: ABCD
3060:
3061: /[a-zA-Z_][a-zA-Z0-9_]*/i
3062: ALPHA
3063:
3064: /^a(bc+|b[eh])g|.h$/i
3065: ABH
3066:
3067: /(bc+d$|ef*g.|h?i(j|k))/i
3068: EFFGZ
3069: IJ
3070: REFFGZ
3071: *** Failers
3072: ADCDCDE
3073: EFFG
3074: BCDD
3075:
3076: /((((((((((a))))))))))/i
3077: A
3078:
3079: /((((((((((a))))))))))\10/i
3080: AA
3081:
3082: /(((((((((a)))))))))/i
3083: A
3084:
3085: /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i
3086: A
3087:
3088: /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i
3089: C
3090:
3091: /multiple words of text/i
3092: *** Failers
3093: AA
3094: UH-UH
3095:
3096: /multiple words/i
3097: MULTIPLE WORDS, YEAH
3098:
3099: /(.*)c(.*)/i
3100: ABCDE
3101:
3102: /\((.*), (.*)\)/i
3103: (A, B)
3104:
3105: /[k]/i
3106:
3107: /abcd/i
3108: ABCD
3109:
3110: /a(bc)d/i
3111: ABCD
3112:
3113: /a[-]?c/i
3114: AC
3115:
3116: /(abc)\1/i
3117: ABCABC
3118:
3119: /([a-c]*)\1/i
3120: ABCABC
3121:
3122: /a(?!b)./
3123: abad
3124:
3125: /a(?=d)./
3126: abad
3127:
3128: /a(?=c|d)./
3129: abad
3130:
3131: /a(?:b|c|d)(.)/
3132: ace
3133:
3134: /a(?:b|c|d)*(.)/
3135: ace
3136:
3137: /a(?:b|c|d)+?(.)/
3138: ace
3139: acdbcdbe
3140:
3141: /a(?:b|c|d)+(.)/
3142: acdbcdbe
3143:
3144: /a(?:b|c|d){2}(.)/
3145: acdbcdbe
3146:
3147: /a(?:b|c|d){4,5}(.)/
3148: acdbcdbe
3149:
3150: /a(?:b|c|d){4,5}?(.)/
3151: acdbcdbe
3152:
3153: /((foo)|(bar))*/
3154: foobar
3155:
3156: /a(?:b|c|d){6,7}(.)/
3157: acdbcdbe
3158:
3159: /a(?:b|c|d){6,7}?(.)/
3160: acdbcdbe
3161:
3162: /a(?:b|c|d){5,6}(.)/
3163: acdbcdbe
3164:
3165: /a(?:b|c|d){5,6}?(.)/
3166: acdbcdbe
3167:
3168: /a(?:b|c|d){5,7}(.)/
3169: acdbcdbe
3170:
3171: /a(?:b|c|d){5,7}?(.)/
3172: acdbcdbe
3173:
3174: /a(?:b|(c|e){1,2}?|d)+?(.)/
3175: ace
3176:
3177: /^(.+)?B/
3178: AB
3179:
3180: /^([^a-z])|(\^)$/
3181: .
3182:
3183: /^[<>]&/
3184: <&OUT
3185:
3186: /^(a\1?){4}$/
3187: aaaaaaaaaa
3188: *** Failers
3189: AB
3190: aaaaaaaaa
3191: aaaaaaaaaaa
3192:
3193: /^(a(?(1)\1)){4}$/
3194: aaaaaaaaaa
3195: *** Failers
3196: aaaaaaaaa
3197: aaaaaaaaaaa
3198:
3199: /(?:(f)(o)(o)|(b)(a)(r))*/
3200: foobar
3201:
3202: /(?<=a)b/
3203: ab
3204: *** Failers
3205: cb
3206: b
3207:
3208: /(?<!c)b/
3209: ab
3210: b
3211: b
3212:
3213: /(?:..)*a/
3214: aba
3215:
3216: /(?:..)*?a/
3217: aba
3218:
3219: /^(?:b|a(?=(.)))*\1/
3220: abc
3221:
3222: /^(){3,5}/
3223: abc
3224:
3225: /^(a+)*ax/
3226: aax
3227:
3228: /^((a|b)+)*ax/
3229: aax
3230:
3231: /^((a|bc)+)*ax/
3232: aax
3233:
3234: /(a|x)*ab/
3235: cab
3236:
3237: /(a)*ab/
3238: cab
3239:
3240: /(?:(?i)a)b/
3241: ab
3242:
3243: /((?i)a)b/
3244: ab
3245:
3246: /(?:(?i)a)b/
3247: Ab
3248:
3249: /((?i)a)b/
3250: Ab
3251:
3252: /(?:(?i)a)b/
3253: *** Failers
3254: cb
3255: aB
3256:
3257: /((?i)a)b/
3258:
3259: /(?i:a)b/
3260: ab
3261:
3262: /((?i:a))b/
3263: ab
3264:
3265: /(?i:a)b/
3266: Ab
3267:
3268: /((?i:a))b/
3269: Ab
3270:
3271: /(?i:a)b/
3272: *** Failers
3273: aB
3274: aB
3275:
3276: /((?i:a))b/
3277:
3278: /(?:(?-i)a)b/i
3279: ab
3280:
3281: /((?-i)a)b/i
3282: ab
3283:
3284: /(?:(?-i)a)b/i
3285: aB
3286:
3287: /((?-i)a)b/i
3288: aB
3289:
3290: /(?:(?-i)a)b/i
3291: *** Failers
3292: aB
3293: Ab
3294:
3295: /((?-i)a)b/i
3296:
3297: /(?:(?-i)a)b/i
3298: aB
3299:
3300: /((?-i)a)b/i
3301: aB
3302:
3303: /(?:(?-i)a)b/i
3304: *** Failers
3305: Ab
3306: AB
3307:
3308: /((?-i)a)b/i
3309:
3310: /(?-i:a)b/i
3311: ab
3312:
3313: /((?-i:a))b/i
3314: ab
3315:
3316: /(?-i:a)b/i
3317: aB
3318:
3319: /((?-i:a))b/i
3320: aB
3321:
3322: /(?-i:a)b/i
3323: *** Failers
3324: AB
3325: Ab
3326:
3327: /((?-i:a))b/i
3328:
3329: /(?-i:a)b/i
3330: aB
3331:
3332: /((?-i:a))b/i
3333: aB
3334:
3335: /(?-i:a)b/i
3336: *** Failers
3337: Ab
3338: AB
3339:
3340: /((?-i:a))b/i
3341:
3342: /((?-i:a.))b/i
3343: *** Failers
3344: AB
3345: a\nB
3346:
3347: /((?s-i:a.))b/i
3348: a\nB
3349:
3350: /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/
3351: cabbbb
3352:
3353: /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/
3354: caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
3355:
3356: /(ab)\d\1/i
3357: Ab4ab
3358: ab4Ab
3359:
3360: /foo\w*\d{4}baz/
3361: foobar1234baz
3362:
3363: /x(~~)*(?:(?:F)?)?/
3364: x~~
3365:
3366: /^a(?#xxx){3}c/
3367: aaac
3368:
3369: /^a (?#xxx) (?#yyy) {3}c/x
3370: aaac
3371:
3372: /(?<![cd])b/
3373: *** Failers
3374: B\nB
3375: dbcb
3376:
3377: /(?<![cd])[ab]/
3378: dbaacb
3379:
3380: /(?<!(c|d))b/
3381:
3382: /(?<!(c|d))[ab]/
3383: dbaacb
3384:
3385: /(?<!cd)[ab]/
3386: cdaccb
3387:
3388: /^(?:a?b?)*$/
3389: \
3390: a
3391: ab
3392: aaa
3393: *** Failers
3394: dbcb
3395: a--
3396: aa--
3397:
3398: /((?s)^a(.))((?m)^b$)/
3399: a\nb\nc\n
3400:
3401: /((?m)^b$)/
3402: a\nb\nc\n
3403:
3404: /(?m)^b/
3405: a\nb\n
3406:
3407: /(?m)^(b)/
3408: a\nb\n
3409:
3410: /((?m)^b)/
3411: a\nb\n
3412:
3413: /\n((?m)^b)/
3414: a\nb\n
3415:
3416: /((?s).)c(?!.)/
3417: a\nb\nc\n
3418: a\nb\nc\n
3419:
3420: /((?s)b.)c(?!.)/
3421: a\nb\nc\n
3422: a\nb\nc\n
3423:
3424: /^b/
3425:
3426: /()^b/
3427: *** Failers
3428: a\nb\nc\n
3429: a\nb\nc\n
3430:
3431: /((?m)^b)/
3432: a\nb\nc\n
3433:
3434: /(x)?(?(1)a|b)/
3435: *** Failers
3436: a
3437: a
3438:
3439: /(x)?(?(1)b|a)/
3440: a
3441:
3442: /()?(?(1)b|a)/
3443: a
3444:
3445: /()(?(1)b|a)/
3446:
3447: /()?(?(1)a|b)/
3448: a
3449:
3450: /^(\()?blah(?(1)(\)))$/
3451: (blah)
3452: blah
3453: *** Failers
3454: a
3455: blah)
3456: (blah
3457:
3458: /^(\(+)?blah(?(1)(\)))$/
3459: (blah)
3460: blah
3461: *** Failers
3462: blah)
3463: (blah
3464:
3465: /(?(?!a)a|b)/
3466:
3467: /(?(?!a)b|a)/
3468: a
3469:
3470: /(?(?=a)b|a)/
3471: *** Failers
3472: a
3473: a
3474:
3475: /(?(?=a)a|b)/
3476: a
3477:
3478: /(?=(a+?))(\1ab)/
3479: aaab
3480:
3481: /^(?=(a+?))\1ab/
3482:
3483: /(\w+:)+/
3484: one:
3485:
3486: /$(?<=^(a))/
3487: a
3488:
3489: /(?=(a+?))(\1ab)/
3490: aaab
3491:
3492: /^(?=(a+?))\1ab/
3493: *** Failers
3494: aaab
3495: aaab
3496:
3497: /([\w:]+::)?(\w+)$/
3498: abcd
3499: xy:z:::abcd
3500:
3501: /^[^bcd]*(c+)/
3502: aexycd
3503:
3504: /(a*)b+/
3505: caab
3506:
3507: /([\w:]+::)?(\w+)$/
3508: abcd
3509: xy:z:::abcd
3510: *** Failers
3511: abcd:
3512: abcd:
3513:
3514: /^[^bcd]*(c+)/
3515: aexycd
3516:
3517: /(>a+)ab/
3518:
3519: /(?>a+)b/
3520: aaab
3521:
3522: /([[:]+)/
3523: a:[b]:
3524:
3525: /([[=]+)/
3526: a=[b]=
3527:
3528: /([[.]+)/
3529: a.[b].
3530:
3531: /((?>a+)b)/
3532: aaab
3533:
3534: /(?>(a+))b/
3535: aaab
3536:
3537: /((?>[^()]+)|\([^()]*\))+/
3538: ((abc(ade)ufh()()x
3539:
3540: /a\Z/
3541: *** Failers
3542: aaab
3543: a\nb\n
3544:
3545: /b\Z/
3546: a\nb\n
3547:
3548: /b\z/
3549:
3550: /b\Z/
3551: a\nb
3552:
3553: /b\z/
3554: a\nb
3555: *** Failers
3556:
3557: /^(?>(?(1)\.|())[^\W_](?>[a-z0-9-]*[^\W_])?)+$/
3558: a
3559: abc
3560: a-b
3561: 0-9
3562: a.b
3563: 5.6.7
3564: the.quick.brown.fox
3565: a100.b200.300c
3566: 12-ab.1245
3567: *** Failers
3568: \
3569: .a
3570: -a
3571: a-
3572: a.
3573: a_b
3574: a.-
3575: a..
3576: ab..bc
3577: the.quick.brown.fox-
3578: the.quick.brown.fox.
3579: the.quick.brown.fox_
3580: the.quick.brown.fox+
3581:
3582: /(?>.*)(?<=(abcd|wxyz))/
3583: alphabetabcd
3584: endingwxyz
3585: *** Failers
3586: a rather long string that doesn't end with one of them
3587:
3588: /word (?>(?:(?!otherword)[a-zA-Z0-9]+ ){0,30})otherword/
3589: word cat dog elephant mussel cow horse canary baboon snake shark otherword
3590: word cat dog elephant mussel cow horse canary baboon snake shark
3591:
3592: /word (?>[a-zA-Z0-9]+ ){0,30}otherword/
3593: word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope
3594:
3595: /(?<=\d{3}(?!999))foo/
3596: 999foo
3597: 123999foo
3598: *** Failers
3599: 123abcfoo
3600:
3601: /(?<=(?!...999)\d{3})foo/
3602: 999foo
3603: 123999foo
3604: *** Failers
3605: 123abcfoo
3606:
3607: /(?<=\d{3}(?!999)...)foo/
3608: 123abcfoo
3609: 123456foo
3610: *** Failers
3611: 123999foo
3612:
3613: /(?<=\d{3}...)(?<!999)foo/
3614: 123abcfoo
3615: 123456foo
3616: *** Failers
3617: 123999foo
3618:
3619: /<a[\s]+href[\s]*=[\s]* # find <a href=
3620: ([\"\'])? # find single or double quote
3621: (?(1) (.*?)\1 | ([^\s]+)) # if quote found, match up to next matching
3622: # quote, otherwise match up to next space
3623: /isx
3624: <a href=abcd xyz
3625: <a href=\"abcd xyz pqr\" cats
3626: <a href=\'abcd xyz pqr\' cats
3627:
3628: /<a\s+href\s*=\s* # find <a href=
3629: (["'])? # find single or double quote
3630: (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
3631: # quote, otherwise match up to next space
3632: /isx
3633: <a href=abcd xyz
3634: <a href=\"abcd xyz pqr\" cats
3635: <a href = \'abcd xyz pqr\' cats
3636:
3637: /<a\s+href(?>\s*)=(?>\s*) # find <a href=
3638: (["'])? # find single or double quote
3639: (?(1) (.*?)\1 | (\S+)) # if quote found, match up to next matching
3640: # quote, otherwise match up to next space
3641: /isx
3642: <a href=abcd xyz
3643: <a href=\"abcd xyz pqr\" cats
3644: <a href = \'abcd xyz pqr\' cats
3645:
3646: /((Z)+|A)*/
3647: ZABCDEFG
3648:
3649: /(Z()|A)*/
3650: ZABCDEFG
3651:
3652: /(Z(())|A)*/
3653: ZABCDEFG
3654:
3655: /((?>Z)+|A)*/
3656: ZABCDEFG
3657:
3658: /((?>)+|A)*/
3659: ZABCDEFG
3660:
3661: /a*/g
3662: abbab
3663:
3664: /^[\d-a]/
3665: abcde
3666: -things
3667: 0digit
3668: *** Failers
3669: bcdef
3670:
3671: /[[:space:]]+/
3672: > \x09\x0a\x0c\x0d\x0b<
3673:
3674: /[[:blank:]]+/
3675: > \x09\x0a\x0c\x0d\x0b<
3676:
3677: /[\s]+/
3678: > \x09\x0a\x0c\x0d\x0b<
3679:
3680: /\s+/
3681: > \x09\x0a\x0c\x0d\x0b<
3682:
3683: /ab/x
3684: ab
3685:
3686: /(?!\A)x/m
3687: a\nxb\n
3688:
3689: /(?!^)x/m
3690: a\nxb\n
3691:
3692: /abc\Qabc\Eabc/
3693: abcabcabc
3694:
3695: /abc\Q(*+|\Eabc/
3696: abc(*+|abc
3697:
3698: / abc\Q abc\Eabc/x
3699: abc abcabc
3700: *** Failers
3701: abcabcabc
3702:
3703: /abc#comment
3704: \Q#not comment
3705: literal\E/x
3706: abc#not comment\n literal
3707:
3708: /abc#comment
3709: \Q#not comment
3710: literal/x
3711: abc#not comment\n literal
3712:
3713: /abc#comment
3714: \Q#not comment
3715: literal\E #more comment
3716: /x
3717: abc#not comment\n literal
3718:
3719: /abc#comment
3720: \Q#not comment
3721: literal\E #more comment/x
3722: abc#not comment\n literal
3723:
3724: /\Qabc\$xyz\E/
3725: abc\\\$xyz
3726:
3727: /\Qabc\E\$\Qxyz\E/
3728: abc\$xyz
3729:
3730: /\Gabc/
3731: abc
3732: *** Failers
3733: xyzabc
3734:
3735: /\Gabc./g
3736: abc1abc2xyzabc3
3737:
3738: /abc./g
3739: abc1abc2xyzabc3
3740:
3741: /a(?x: b c )d/
3742: XabcdY
3743: *** Failers
3744: Xa b c d Y
3745:
3746: /((?x)x y z | a b c)/
3747: XabcY
3748: AxyzB
3749:
3750: /(?i)AB(?-i)C/
3751: XabCY
3752: *** Failers
3753: XabcY
3754:
3755: /((?i)AB(?-i)C|D)E/
3756: abCE
3757: DE
3758: *** Failers
3759: abcE
3760: abCe
3761: dE
3762: De
3763:
3764: /(.*)\d+\1/
3765: abc123abc
3766: abc123bc
3767:
3768: /(.*)\d+\1/s
3769: abc123abc
3770: abc123bc
3771:
3772: /((.*))\d+\1/
3773: abc123abc
3774: abc123bc
3775:
1.1.1.4 misho 3776: /-- This tests for an IPv6 address in the form where it can have up to
3777: eight components, one and only one of which is empty. This must be
3778: an internal component. --/
1.1 misho 3779:
3780: /^(?!:) # colon disallowed at start
3781: (?: # start of item
3782: (?: [0-9a-f]{1,4} | # 1-4 hex digits or
3783: (?(1)0 | () ) ) # if null previously matched, fail; else null
3784: : # followed by colon
3785: ){1,7} # end item; 1-7 of them required
3786: [0-9a-f]{1,4} $ # final hex number at end of string
3787: (?(1)|.) # check that there was an empty component
3788: /xi
3789: a123::a123
3790: a123:b342::abcd
3791: a123:b342::324e:abcd
3792: a123:ddde:b342::324e:abcd
3793: a123:ddde:b342::324e:dcba:abcd
3794: a123:ddde:9999:b342::324e:dcba:abcd
3795: *** Failers
3796: 1:2:3:4:5:6:7:8
3797: a123:bce:ddde:9999:b342::324e:dcba:abcd
3798: a123::9999:b342::324e:dcba:abcd
3799: abcde:2:3:4:5:6:7:8
3800: ::1
3801: abcd:fee0:123::
3802: :1
3803: 1:
3804:
3805: /[z\Qa-d]\E]/
3806: z
3807: a
3808: -
3809: d
3810: ]
3811: *** Failers
3812: b
3813:
3814: /[\z\C]/
3815: z
3816: C
3817:
3818: /\M/
3819: M
3820:
3821: /(a+)*b/
3822: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3823:
3824: /(?i)reg(?:ul(?:[a]|ae)r|ex)/
3825: REGular
3826: regulaer
3827: Regex
3828: regulr
3829:
3830: /[--]+/
3831:
3832:
3833:
3834:
3835:
3836: /(?<=Z)X./
3837: \x84XAZXB
3838:
3839: /ab cd (?x) de fg/
3840: ab cd defg
3841:
3842: /ab cd(?x) de fg/
3843: ab cddefg
3844: ** Failers
3845: abcddefg
3846:
3847: /(?<![^f]oo)(bar)/
3848: foobarX
3849: ** Failers
3850: boobarX
3851:
3852: /(?<![^f])X/
3853: offX
3854: ** Failers
3855: onyX
3856:
3857: /(?<=[^f])X/
3858: onyX
3859: ** Failers
3860: offX
3861:
3862: /^/mg
3863: a\nb\nc\n
3864: \
3865:
3866: /(?<=C\n)^/mg
3867: A\nC\nC\n
3868:
3869: /(?:(?(1)a|b)(X))+/
3870: bXaX
3871:
3872: /(?:(?(1)\1a|b)(X|Y))+/
3873: bXXaYYaY
3874: bXYaXXaX
3875:
3876: /()()()()()()()()()(?:(?(10)\10a|b)(X|Y))+/
3877: bXXaYYaY
3878:
3879: /[[,abc,]+]/
3880: abc]
3881: a,b]
3882: [a,b,c]
3883:
3884: /(?-x: )/x
3885: A\x20B
3886:
3887: "(?x)(?-x: \s*#\s*)"
3888: A # B
3889: ** Failers
3890: #
3891:
3892: "(?x-is)(?:(?-ixs) \s*#\s*) include"
3893: A #include
3894: ** Failers
3895: A#include
3896: A #Include
3897:
3898: /a*b*\w/
3899: aaabbbb
3900: aaaa
3901: a
3902:
3903: /a*b?\w/
3904: aaabbbb
3905: aaaa
3906: a
3907:
3908: /a*b{0,4}\w/
3909: aaabbbb
3910: aaaa
3911: a
3912:
3913: /a*b{0,}\w/
3914: aaabbbb
3915: aaaa
3916: a
3917:
3918: /a*\d*\w/
3919: 0a
3920: a
3921:
3922: /a*b *\w/x
3923: a
3924:
3925: /a*b#comment
3926: *\w/x
3927: a
3928:
3929: /a* b *\w/x
3930: a
3931:
3932: /^\w+=.*(\\\n.*)*/
3933: abc=xyz\\\npqr
3934:
3935: /(?=(\w+))\1:/
3936: abcd:
3937:
3938: /^(?=(\w+))\1:/
3939: abcd:
3940:
3941: /^\Eabc/
3942: abc
3943:
3944: /^[\Eabc]/
3945: a
3946: ** Failers
3947: E
3948:
3949: /^[a-\Ec]/
3950: b
3951: ** Failers
3952: -
3953: E
3954:
3955: /^[a\E\E-\Ec]/
3956: b
3957: ** Failers
3958: -
3959: E
3960:
3961: /^[\E\Qa\E-\Qz\E]+/
3962: b
3963: ** Failers
3964: -
3965:
3966: /^[a\Q]bc\E]/
3967: a
3968: ]
3969: c
3970:
3971: /^[a-\Q\E]/
3972: a
3973: -
3974:
3975: /^(a()*)*/
3976: aaaa
3977:
3978: /^(?:a(?:(?:))*)*/
3979: aaaa
3980:
3981: /^(a()+)+/
3982: aaaa
3983:
3984: /^(?:a(?:(?:))+)+/
3985: aaaa
3986:
3987: /(a){0,3}(?(1)b|(c|))*D/
3988: abbD
3989: ccccD
3990: D
3991:
3992: /(a|)*\d/
3993: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3994: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
3995:
3996: /(?>a|)*\d/
3997: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
3998: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
3999:
4000: /(?:a|)*\d/
4001: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4002: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4
4003:
4004: /\Z/g
4005: abc\n
4006:
4007: /^(?s)(?>.*)(?<!\n)/
4008: abc
4009: abc\n
4010:
4011: /^(?![^\n]*\n\z)/
4012: abc
4013: abc\n
4014:
4015: /\z(?<!\n)/
4016: abc
4017: abc\n
4018:
4019: /(.*(.)?)*/
4020: abcd
4021:
4022: /( (A | (?(1)0|) )* )/x
4023: abcd
4024:
4025: /( ( (?(1)0|) )* )/x
4026: abcd
4027:
4028: /( (?(1)0|)* )/x
4029: abcd
4030:
4031: /[[:abcd:xyz]]/
4032: a]
4033: :]
4034:
4035: /[abc[:x\]pqr]/
4036: a
4037: [
4038: :
4039: ]
4040: p
4041:
4042: /.*[op][xyz]/
4043: fooabcfoo
4044:
4045: /(?(?=.*b)b|^)/
4046: adc
4047: abc
4048:
4049: /(?(?=^.*b)b|^)/
4050: adc
4051: abc
4052:
4053: /(?(?=.*b)b|^)*/
4054: adc
4055: abc
4056:
4057: /(?(?=.*b)b|^)+/
4058: adc
4059: abc
4060:
4061: /(?(?=b).*b|^d)/
4062: abc
4063:
4064: /(?(?=.*b).*b|^d)/
4065: abc
4066:
4067: /^%((?(?=[a])[^%])|b)*%$/
4068: %ab%
4069:
4070: /(?i)a(?-i)b|c/
4071: XabX
4072: XAbX
4073: CcC
4074: ** Failers
4075: XABX
4076:
4077: /[\x00-\xff\s]+/
4078: \x0a\x0b\x0c\x0d
4079:
4080: /^\c/
4081: ?
4082:
4083: /(abc)\1/i
4084: abc
4085:
4086: /(abc)\1/
4087: abc
4088:
4089: /[^a]*/i
4090: 12abc
4091: 12ABC
4092:
4093: /[^a]*+/i
4094: 12abc
4095: 12ABC
4096:
4097: /[^a]*?X/i
4098: ** Failers
4099: 12abc
4100: 12ABC
4101:
4102: /[^a]+?X/i
4103: ** Failers
4104: 12abc
4105: 12ABC
4106:
4107: /[^a]?X/i
4108: 12aXbcX
4109: 12AXBCX
4110: BCX
4111:
4112: /[^a]??X/i
4113: 12aXbcX
4114: 12AXBCX
4115: BCX
4116:
4117: /[^a]?+X/i
4118: 12aXbcX
4119: 12AXBCX
4120: BCX
4121:
4122: /[^a]{2,3}/i
4123: abcdef
4124: ABCDEF
4125:
4126: /[^a]{2,3}?/i
4127: abcdef
4128: ABCDEF
4129:
4130: /[^a]{2,3}+/i
4131: abcdef
4132: ABCDEF
4133:
4134: /((a|)+)+Z/
4135: Z
4136:
4137: /(a)b|(a)c/
4138: ac
4139:
4140: /(?>(a))b|(a)c/
4141: ac
4142:
4143: /(?=(a))ab|(a)c/
4144: ac
4145:
4146: /((?>(a))b|(a)c)/
4147: ac
4148:
4149: /((?>(a))b|(a)c)++/
4150: ac
4151:
4152: /(?:(?>(a))b|(a)c)++/
4153: ac
4154:
4155: /(?=(?>(a))b|(a)c)(..)/
4156: ac
4157:
4158: /(?>(?>(a))b|(a)c)/
4159: ac
4160:
4161: /(?:(?>([ab])))+a=/+
4162: =ba=
4163:
4164: /(?>([ab]))+a=/+
4165: =ba=
4166:
4167: /((?>(a+)b)+(aabab))/
4168: aaaabaaabaabab
4169:
4170: /(?>a+|ab)+?c/
4171: aabc
4172:
4173: /(?>a+|ab)+c/
4174: aabc
4175:
4176: /(?:a+|ab)+c/
4177: aabc
4178:
4179: /(?(?=(a))a)/
4180: a
4181:
4182: /(?(?=(a))a)(b)/
4183: ab
4184:
4185: /^(?:a|ab)++c/
4186: aaaabc
4187:
4188: /^(?>a|ab)++c/
4189: aaaabc
4190:
4191: /^(?:a|ab)+c/
4192: aaaabc
4193:
4194: /(?=abc){3}abc/+
4195: abcabcabc
4196: ** Failers
4197: xyz
4198:
4199: /(?=abc)+abc/+
4200: abcabcabc
4201: ** Failers
4202: xyz
4203:
4204: /(?=abc)++abc/+
4205: abcabcabc
4206: ** Failers
4207: xyz
4208:
4209: /(?=abc){0}xyz/
4210: xyz
4211:
4212: /(?=abc){1}xyz/
4213: ** Failers
4214: xyz
4215:
4216: /(?=(a))?./
4217: ab
4218: bc
4219:
4220: /(?=(a))??./
4221: ab
4222: bc
4223:
4224: /^(?=(?1))?[az]([abc])d/
4225: abd
4226: zcdxx
4227:
4228: /^(?!a){0}\w+/
4229: aaaaa
4230:
4231: /(?<=(abc))?xyz/
4232: abcxyz
4233: pqrxyz
4234:
4235: /^[\g<a>]+/
4236: ggg<<<aaa>>>
4237: ** Failers
4238: \\ga
4239:
4240: /^[\ga]+/
4241: gggagagaxyz
4242:
4243: /^[:a[:digit:]]+/
4244: aaaa444:::Z
4245:
4246: /^[:a[:digit:]:b]+/
4247: aaaa444:::bbbZ
4248:
4249: /[:a]xxx[b:]/
4250: :xxx:
4251:
4252: /(?<=a{2})b/i
4253: xaabc
4254: ** Failers
4255: xabc
4256:
4257: /(?<!a{2})b/i
4258: xabc
4259: ** Failers
4260: xaabc
4261:
4262: /(?<=a\h)c/
4263: xa c
4264:
4265: /(?<=[^a]{2})b/
4266: axxbc
4267: aAAbc
4268: ** Failers
4269: xaabc
4270:
4271: /(?<=[^a]{2})b/i
4272: axxbc
4273: ** Failers
4274: aAAbc
4275: xaabc
4276:
4277: /(?<=a\H)c/
4278: abc
4279:
4280: /(?<=a\V)c/
4281: abc
4282:
4283: /(?<=a\v)c/
4284: a\nc
4285:
4286: /(?(?=c)c|d)++Y/
4287: XcccddYX
4288:
4289: /(?(?=c)c|d)*+Y/
4290: XcccddYX
4291:
4292: /^(a{2,3}){2,}+a/
4293: aaaaaaa
4294: ** Failers
4295: aaaaaa
4296: aaaaaaaaa
4297:
4298: /^(a{2,3})++a/
4299: ** Failers
4300: aaaaaa
4301:
4302: /^(a{2,3})*+a/
4303: ** Failers
4304: aaaaaa
4305:
4306: /ab\Cde/
4307: abXde
4308:
4309: /(?<=ab\Cde)X/
4310: abZdeX
4311:
4312: /a[\CD]b/
4313: aCb
4314: aDb
4315:
4316: /a[\C-X]b/
4317: aJb
4318:
1.1.1.2 misho 4319: /\H\h\V\v/
4320: X X\x0a
4321: X\x09X\x0b
4322: ** Failers
4323: \xa0 X\x0a
4324:
4325: /\H*\h+\V?\v{3,4}/
4326: \x09\x20\xa0X\x0a\x0b\x0c\x0d\x0a
4327: \x09\x20\xa0\x0a\x0b\x0c\x0d\x0a
4328: \x09\x20\xa0\x0a\x0b\x0c
4329: ** Failers
4330: \x09\x20\xa0\x0a\x0b
4331:
4332: /\H{3,4}/
4333: XY ABCDE
4334: XY PQR ST
4335:
4336: /.\h{3,4}./
4337: XY AB PQRS
4338:
4339: /\h*X\h?\H+Y\H?Z/
4340: >XNNNYZ
4341: > X NYQZ
4342: ** Failers
4343: >XYZ
4344: > X NY Z
4345:
4346: /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/
4347: >XY\x0aZ\x0aA\x0bNN\x0c
4348: >\x0a\x0dX\x0aY\x0a\x0bZZZ\x0aAAA\x0bNNN\x0c
4349:
4350: /(foo)\Kbar/
4351: foobar
4352:
4353: /(foo)(\Kbar|baz)/
4354: foobar
4355: foobaz
4356:
4357: /(foo\Kbar)baz/
4358: foobarbaz
4359:
4360: /abc\K|def\K/g+
4361: Xabcdefghi
4362:
4363: /ab\Kc|de\Kf/g+
4364: Xabcdefghi
4365:
4366: /(?=C)/g+
4367: ABCDECBA
4368:
4369: /^abc\K/+
4370: abcdef
4371: ** Failers
4372: defabcxyz
4373:
4374: /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/
4375: ababababbbabZXXXX
4376:
4377: /(?<A>tom|bon)-\g{A}/
4378: tom-tom
4379: bon-bon
4380:
4381: /(^(a|b\g{-1}))/
4382: bacxxx
4383:
4384: /(?|(abc)|(xyz))\1/
4385: abcabc
4386: xyzxyz
4387: ** Failers
4388: abcxyz
4389: xyzabc
4390:
4391: /(?|(abc)|(xyz))(?1)/
4392: abcabc
4393: xyzabc
4394: ** Failers
4395: xyzxyz
4396:
4397: /^X(?5)(a)(?|(b)|(q))(c)(d)(Y)/
4398: XYabcdY
4399:
4400: /^X(?7)(a)(?|(b|(r)(s))|(q))(c)(d)(Y)/
4401: XYabcdY
4402:
4403: /^X(?7)(a)(?|(b|(?|(r)|(t))(s))|(q))(c)(d)(Y)/
4404: XYabcdY
4405:
4406: /(?'abc'\w+):\k<abc>{2}/
4407: a:aaxyz
4408: ab:ababxyz
4409: ** Failers
4410: a:axyz
4411: ab:abxyz
4412:
4413: /(?'abc'\w+):\g{abc}{2}/
4414: a:aaxyz
4415: ab:ababxyz
4416: ** Failers
4417: a:axyz
4418: ab:abxyz
4419:
4420: /^(?<ab>a)? (?(<ab>)b|c) (?('ab')d|e)/x
4421: abd
4422: ce
4423:
4424: /^(a.)\g-1Z/
4425: aXaXZ
4426:
4427: /^(a.)\g{-1}Z/
4428: aXaXZ
4429:
4430: /^(?(DEFINE) (?<A> a) (?<B> b) ) (?&A) (?&B) /x
4431: abcd
4432:
4433: /(?<NAME>(?&NAME_PAT))\s+(?<ADDR>(?&ADDRESS_PAT))
4434: (?(DEFINE)
4435: (?<NAME_PAT>[a-z]+)
4436: (?<ADDRESS_PAT>\d+)
4437: )/x
4438: metcalfe 33
4439:
4440: /(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))\b(?&byte)(\.(?&byte)){3}/
4441: 1.2.3.4
4442: 131.111.10.206
4443: 10.0.0.0
4444: ** Failers
4445: 10.6
4446: 455.3.4.5
4447:
4448: /\b(?&byte)(\.(?&byte)){3}(?(DEFINE)(?<byte>2[0-4]\d|25[0-5]|1\d\d|[1-9]?\d))/
4449: 1.2.3.4
4450: 131.111.10.206
4451: 10.0.0.0
4452: ** Failers
4453: 10.6
4454: 455.3.4.5
4455:
4456: /^(\w++|\s++)*$/
4457: now is the time for all good men to come to the aid of the party
4458: *** Failers
4459: this is not a line with only words and spaces!
4460:
4461: /(\d++)(\w)/
4462: 12345a
4463: *** Failers
4464: 12345+
4465:
4466: /a++b/
4467: aaab
4468:
4469: /(a++b)/
4470: aaab
4471:
4472: /(a++)b/
4473: aaab
4474:
4475: /([^()]++|\([^()]*\))+/
4476: ((abc(ade)ufh()()x
4477:
4478: /\(([^()]++|\([^()]+\))+\)/
4479: (abc)
4480: (abc(def)xyz)
4481: *** Failers
4482: ((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
4483:
4484: /^([^()]|\((?1)*\))*$/
4485: abc
4486: a(b)c
4487: a(b(c))d
4488: *** Failers)
4489: a(b(c)d
4490:
4491: /^>abc>([^()]|\((?1)*\))*<xyz<$/
4492: >abc>123<xyz<
4493: >abc>1(2)3<xyz<
4494: >abc>(1(2)3)<xyz<
4495:
4496: /^(?:((.)(?1)\2|)|((.)(?3)\4|.))$/i
4497: 1221
4498: Satanoscillatemymetallicsonatas
4499: AmanaplanacanalPanama
4500: AblewasIereIsawElba
4501: *** Failers
4502: Thequickbrownfox
4503:
4504: /^(\d+|\((?1)([+*-])(?1)\)|-(?1))$/
4505: 12
4506: (((2+2)*-3)-7)
4507: -12
4508: *** Failers
4509: ((2+2)*-3)-7)
4510:
4511: /^(x(y|(?1){2})z)/
4512: xyz
4513: xxyzxyzz
4514: *** Failers
4515: xxyzz
4516: xxyzxyzxyzz
4517:
4518: /((< (?: (?(R) \d++ | [^<>]*+) | (?2)) * >))/x
4519: <>
4520: <abcd>
4521: <abc <123> hij>
4522: <abc <def> hij>
4523: <abc<>def>
4524: <abc<>
4525: *** Failers
4526: <abc
4527:
4528: /^a+(*FAIL)/
4529: aaaaaa
4530:
4531: /a+b?c+(*FAIL)/
4532: aaabccc
4533:
4534: /a+b?(*PRUNE)c+(*FAIL)/
4535: aaabccc
4536:
4537: /a+b?(*COMMIT)c+(*FAIL)/
4538: aaabccc
4539:
4540: /a+b?(*SKIP)c+(*FAIL)/
4541: aaabcccaaabccc
4542:
4543: /^(?:aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
4544: aaaxxxxxx
4545: aaa++++++
4546: bbbxxxxx
4547: bbb+++++
4548: cccxxxx
4549: ccc++++
4550: dddddddd
4551:
4552: /^(aaa(*THEN)\w{6}|bbb(*THEN)\w{5}|ccc(*THEN)\w{4}|\w{3})/
4553: aaaxxxxxx
4554: aaa++++++
4555: bbbxxxxx
4556: bbb+++++
4557: cccxxxx
4558: ccc++++
4559: dddddddd
4560:
4561: /a+b?(*THEN)c+(*FAIL)/
4562: aaabccc
4563:
4564: /(A (A|B(*ACCEPT)|C) D)(E)/x
4565: AB
4566: ABX
4567: AADE
4568: ACDE
4569: ** Failers
4570: AD
4571:
4572: /^\W*+(?:((.)\W*+(?1)\W*+\2|)|((.)\W*+(?3)\W*+\4|\W*+.\W*+))\W*+$/i
4573: 1221
4574: Satan, oscillate my metallic sonatas!
4575: A man, a plan, a canal: Panama!
4576: Able was I ere I saw Elba.
4577: *** Failers
4578: The quick brown fox
4579:
4580: /^((.)(?1)\2|.)$/
4581: a
4582: aba
4583: aabaa
4584: abcdcba
4585: pqaabaaqp
4586: ablewasiereisawelba
4587: rhubarb
4588: the quick brown fox
4589:
4590: /(a)(?<=b(?1))/
4591: baz
4592: ** Failers
4593: caz
4594:
4595: /(?<=b(?1))(a)/
4596: zbaaz
4597: ** Failers
4598: aaa
4599:
4600: /(?<X>a)(?<=b(?&X))/
4601: baz
4602:
4603: /^(?|(abc)|(def))\1/
4604: abcabc
4605: defdef
4606: ** Failers
4607: abcdef
4608: defabc
4609:
4610: /^(?|(abc)|(def))(?1)/
4611: abcabc
4612: defabc
4613: ** Failers
4614: defdef
4615: abcdef
4616:
4617: /(?:a(?<quote> (?<apostrophe>')|(?<realquote>")) |b(?<quote> (?<apostrophe>')|(?<realquote>")) ) (?('quote')[a-z]+|[0-9]+)/xJ
4618: a\"aaaaa
4619: b\"aaaaa
4620: ** Failers
4621: b\"11111
4622:
4623: /(?:(?1)|B)(A(*F)|C)/
4624: ABCD
4625: CCD
4626: ** Failers
4627: CAD
4628:
4629: /^(?:(?1)|B)(A(*F)|C)/
4630: CCD
4631: BCD
4632: ** Failers
4633: ABCD
4634: CAD
4635: BAD
4636:
4637: /(?:(?1)|B)(A(*ACCEPT)XX|C)D/
4638: AAD
4639: ACD
4640: BAD
4641: BCD
4642: BAX
4643: ** Failers
4644: ACX
4645: ABC
4646:
4647: /(?(DEFINE)(A))B(?1)C/
4648: BAC
4649:
4650: /(?(DEFINE)((A)\2))B(?1)C/
4651: BAAC
4652:
4653: /(?<pn> \( ( [^()]++ | (?&pn) )* \) )/x
4654: (ab(cd)ef)
4655:
4656: /^(?=a(*SKIP)b|ac)/
4657: ** Failers
4658: ac
4659:
4660: /^(?=a(*PRUNE)b)/
4661: ab
4662: ** Failers
4663: ac
4664:
4665: /^(?=a(*ACCEPT)b)/
4666: ac
4667:
4668: /(?>a\Kb)/
4669: ab
4670:
4671: /((?>a\Kb))/
4672: ab
4673:
4674: /(a\Kb)/
4675: ab
4676:
4677: /^a\Kcz|ac/
4678: ac
4679:
4680: /(?>a\Kbz|ab)/
4681: ab
4682:
4683: /^(?&t)(?(DEFINE)(?<t>a\Kb))$/
4684: ab
4685:
4686: /^([^()]|\((?1)*\))*$/
4687: a(b)c
4688: a(b(c)d)e
4689:
4690: /(?P<L1>(?P<L2>0)(?P>L1)|(?P>L2))/
4691: 0
4692: 00
4693: 0000
4694:
4695: /(?P<L1>(?P<L2>0)|(?P>L2)(?P>L1))/
4696: 0
4697: 00
4698: 0000
4699:
4700: /--- This one does fail, as expected, in Perl. It needs the complex item at the
4701: end of the pattern. A single letter instead of (B|D) makes it not fail,
4702: which I think is a Perl bug. --- /
4703:
4704: /A(*COMMIT)(B|D)/
4705: ACABX
4706:
4707: /--- Check the use of names for failure ---/
4708:
4709: /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
4710: ** Failers
4711: AC
4712: CB
4713:
4714: /--- Force no study, otherwise mark is not seen. The studied version is in
4715: test 2 because it isn't Perl-compatible. ---/
4716:
4717: /(*MARK:A)(*SKIP:B)(C|X)/KSS
4718: C
4719: D
4720:
4721: /^(A(*THEN:A)B|C(*THEN:B)D)/K
4722: ** Failers
4723: CB
4724:
4725: /^(?:A(*THEN:A)B|C(*THEN:B)D)/K
4726: CB
4727:
4728: /^(?>A(*THEN:A)B|C(*THEN:B)D)/K
4729: CB
4730:
4731: /--- This should succeed, as the skip causes bump to offset 1 (the mark). Note
4732: that we have to have something complicated such as (B|Z) at the end because,
4733: for Perl, a simple character somehow causes an unwanted optimization to mess
4734: with the handling of backtracking verbs. ---/
4735:
4736: /A(*MARK:A)A+(*SKIP:A)(B|Z) | AC/xK
4737: AAAC
4738:
4739: /--- Test skipping over a non-matching mark. ---/
4740:
4741: /A(*MARK:A)A+(*MARK:B)(*SKIP:A)(B|Z) | AC/xK
4742: AAAC
4743:
4744: /--- Check shorthand for MARK ---/
4745:
4746: /A(*:A)A+(*SKIP:A)(B|Z) | AC/xK
4747: AAAC
4748:
4749: /--- Don't loop! Force no study, otherwise mark is not seen. ---/
4750:
4751: /(*:A)A+(*SKIP:A)(B|Z)/KSS
4752: AAAC
4753:
4754: /--- This should succeed, as a non-existent skip name disables the skip ---/
4755:
4756: /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
4757: AAAC
4758:
4759: /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC(*:B)/xK
4760: AAAC
4761:
4762: /--- COMMIT at the start of a pattern should act like an anchor. Again,
4763: however, we need the complication for Perl. ---/
4764:
4765: /(*COMMIT)(A|P)(B|P)(C|P)/
4766: ABCDEFG
4767: ** Failers
4768: DEFGABC
4769:
4770: /--- COMMIT inside an atomic group can't stop backtracking over the group. ---/
4771:
4772: /(\w+)(?>b(*COMMIT))\w{2}/
4773: abbb
4774:
4775: /(\w+)b(*COMMIT)\w{2}/
4776: abbb
4777:
4778: /--- Check opening parens in comment when seeking forward reference. ---/
4779:
4780: /(?&t)(?#()(?(DEFINE)(?<t>a))/
4781: bac
4782:
4783: /--- COMMIT should override THEN ---/
4784:
4785: /(?>(*COMMIT)(?>yes|no)(*THEN)(*F))?/
4786: yes
4787:
4788: /(?>(*COMMIT)(yes|no)(*THEN)(*F))?/
4789: yes
4790:
4791: /b?(*SKIP)c/
4792: bc
4793: abc
4794:
4795: /(*SKIP)bc/
4796: a
4797:
4798: /(*SKIP)b/
4799: a
4800:
4801: /(?P<abn>(?P=abn)xxx|)+/
4802: xxx
4803:
4804: /(?i:([^b]))(?1)/
4805: aa
4806: aA
4807: ** Failers
4808: ab
4809: aB
4810: Ba
4811: ba
4812:
4813: /^(?&t)*+(?(DEFINE)(?<t>a))\w$/
4814: aaaaaaX
4815: ** Failers
4816: aaaaaa
4817:
4818: /^(?&t)*(?(DEFINE)(?<t>a))\w$/
4819: aaaaaaX
4820: aaaaaa
4821:
4822: /^(a)*+(\w)/
4823: aaaaX
4824: YZ
4825: ** Failers
4826: aaaa
4827:
4828: /^(?:a)*+(\w)/
4829: aaaaX
4830: YZ
4831: ** Failers
4832: aaaa
4833:
4834: /^(a)++(\w)/
4835: aaaaX
4836: ** Failers
4837: aaaa
4838: YZ
4839:
4840: /^(?:a)++(\w)/
4841: aaaaX
4842: ** Failers
4843: aaaa
4844: YZ
4845:
4846: /^(a)?+(\w)/
4847: aaaaX
4848: YZ
4849:
4850: /^(?:a)?+(\w)/
4851: aaaaX
4852: YZ
4853:
4854: /^(a){2,}+(\w)/
4855: aaaaX
4856: ** Failers
4857: aaa
4858: YZ
4859:
4860: /^(?:a){2,}+(\w)/
4861: aaaaX
4862: ** Failers
4863: aaa
4864: YZ
4865:
4866: /(a|)*(?1)b/
4867: b
4868: ab
4869: aab
4870:
4871: /(a)++(?1)b/
4872: ** Failers
4873: ab
4874: aab
4875:
4876: /(a)*+(?1)b/
4877: ** Failers
4878: ab
4879: aab
4880:
4881: /(?1)(?:(b)){0}/
4882: b
4883:
4884: /(foo ( \( ((?:(?> [^()]+ )|(?2))*) \) ) )/x
4885: foo(bar(baz)+baz(bop))
4886:
4887: /(A (A|B(*ACCEPT)|C) D)(E)/x
4888: AB
4889:
4890: /\A.*?(a|bc)/
4891: ba
4892:
4893: /\A.*?(?:a|bc)++/
4894: ba
4895:
4896: /\A.*?(a|bc)++/
4897: ba
4898:
4899: /\A.*?(?:a|bc|d)/
4900: ba
4901:
4902: /(?:(b))++/
4903: beetle
4904:
4905: /(?(?=(a(*ACCEPT)z))a)/
4906: a
4907:
4908: /^(a)(?1)+ab/
4909: aaaab
4910:
4911: /^(a)(?1)++ab/
4912: aaaab
4913:
4914: /^(?=a(*:M))aZ/K
4915: aZbc
4916:
4917: /^(?!(*:M)b)aZ/K
4918: aZbc
4919:
4920: /(?(DEFINE)(a))?b(?1)/
4921: backgammon
4922:
4923: /^\N+/
4924: abc\ndef
4925:
4926: /^\N{1,}/
4927: abc\ndef
4928:
4929: /(?(R)a+|(?R)b)/
4930: aaaabcde
4931:
4932: /(?(R)a+|((?R))b)/
4933: aaaabcde
4934:
4935: /((?(R)a+|(?1)b))/
4936: aaaabcde
4937:
4938: /((?(R1)a+|(?1)b))/
4939: aaaabcde
4940:
4941: /a(*:any
4942: name)/K
4943: abc
4944:
4945: /(?>(?&t)c|(?&t))(?(DEFINE)(?<t>a|b(*PRUNE)c))/
4946: a
4947: ba
4948: bba
4949:
4950: /--- Checking revised (*THEN) handling ---/
4951:
4952: /--- Capture ---/
4953:
4954: /^.*? (a(*THEN)b) c/x
4955: aabc
4956:
4957: /^.*? (a(*THEN)b|(*F)) c/x
4958: aabc
4959:
4960: /^.*? ( (a(*THEN)b) | (*F) ) c/x
4961: aabc
4962:
4963: /^.*? ( (a(*THEN)b) ) c/x
4964: aabc
4965:
4966: /--- Non-capture ---/
4967:
4968: /^.*? (?:a(*THEN)b) c/x
4969: aabc
4970:
4971: /^.*? (?:a(*THEN)b|(*F)) c/x
4972: aabc
4973:
4974: /^.*? (?: (?:a(*THEN)b) | (*F) ) c/x
4975: aabc
4976:
4977: /^.*? (?: (?:a(*THEN)b) ) c/x
4978: aabc
4979:
4980: /--- Atomic ---/
4981:
4982: /^.*? (?>a(*THEN)b) c/x
4983: aabc
4984:
4985: /^.*? (?>a(*THEN)b|(*F)) c/x
4986: aabc
4987:
4988: /^.*? (?> (?>a(*THEN)b) | (*F) ) c/x
4989: aabc
4990:
4991: /^.*? (?> (?>a(*THEN)b) ) c/x
4992: aabc
4993:
4994: /--- Possessive capture ---/
4995:
4996: /^.*? (a(*THEN)b)++ c/x
4997: aabc
4998:
4999: /^.*? (a(*THEN)b|(*F))++ c/x
5000: aabc
5001:
5002: /^.*? ( (a(*THEN)b)++ | (*F) )++ c/x
5003: aabc
5004:
5005: /^.*? ( (a(*THEN)b)++ )++ c/x
5006: aabc
5007:
5008: /--- Possessive non-capture ---/
5009:
5010: /^.*? (?:a(*THEN)b)++ c/x
5011: aabc
5012:
5013: /^.*? (?:a(*THEN)b|(*F))++ c/x
5014: aabc
5015:
5016: /^.*? (?: (?:a(*THEN)b)++ | (*F) )++ c/x
5017: aabc
5018:
5019: /^.*? (?: (?:a(*THEN)b)++ )++ c/x
5020: aabc
5021:
5022: /--- Condition assertion ---/
5023:
5024: /^(?(?=a(*THEN)b)ab|ac)/
5025: ac
5026:
5027: /--- Condition ---/
5028:
5029: /^.*?(?(?=a)a|b(*THEN)c)/
5030: ba
5031:
5032: /^.*?(?:(?(?=a)a|b(*THEN)c)|d)/
5033: ba
5034:
5035: /^.*?(?(?=a)a(*THEN)b|c)/
5036: ac
5037:
5038: /--- Assertion ---/
5039:
5040: /^.*(?=a(*THEN)b)/
5041: aabc
5042:
5043: /------------------------------/
5044:
5045: /(?>a(*:m))/imsxSK
5046: a
5047:
5048: /(?>(a)(*:m))/imsxSK
5049: a
5050:
5051: /(?<=a(*ACCEPT)b)c/
5052: xacd
5053:
5054: /(?<=(a(*ACCEPT)b))c/
5055: xacd
5056:
5057: /(?<=(a(*COMMIT)b))c/
5058: xabcd
5059: ** Failers
5060: xacd
5061:
5062: /(?<!a(*FAIL)b)c/
5063: xcd
5064: acd
5065:
5066: /(?<=a(*:N)b)c/K
5067: xabcd
5068:
5069: /(?<=a(*PRUNE)b)c/
5070: xabcd
5071:
5072: /(?<=a(*SKIP)b)c/
5073: xabcd
5074:
5075: /(?<=a(*THEN)b)c/
5076: xabcd
5077:
5078: /(a)(?2){2}(.)/
5079: abcd
5080:
5081: /(*MARK:A)(*PRUNE:B)(C|X)/KS
5082: C
5083: D
5084:
5085: /(*MARK:A)(*PRUNE:B)(C|X)/KSS
5086: C
5087: D
5088:
5089: /(*MARK:A)(*THEN:B)(C|X)/KS
5090: C
5091: D
5092:
5093: /(*MARK:A)(*THEN:B)(C|X)/KSY
5094: C
5095: D
5096:
5097: /(*MARK:A)(*THEN:B)(C|X)/KSS
5098: C
5099: D
5100:
5101: /--- This should fail, as the skip causes a bump to offset 3 (the skip) ---/
5102:
5103: /A(*MARK:A)A+(*SKIP)(B|Z) | AC/xK
5104: AAAC
5105:
5106: /--- Same --/
5107:
5108: /A(*MARK:A)A+(*MARK:B)(*SKIP:B)(B|Z) | AC/xK
5109: AAAC
5110:
5111: /A(*:A)A+(*SKIP)(B|Z) | AC/xK
5112: AAAC
5113:
5114: /--- This should fail, as a null name is the same as no name ---/
5115:
5116: /A(*MARK:A)A+(*SKIP:)(B|Z) | AC/xK
5117: AAAC
5118:
5119: /--- A check on what happens after hitting a mark and them bumping along to
5120: something that does not even start. Perl reports tags after the failures here,
5121: though it does not when the individual letters are made into something
5122: more complicated. ---/
5123:
5124: /A(*:A)B|XX(*:B)Y/K
5125: AABC
5126: XXYZ
5127: ** Failers
5128: XAQQ
5129: XAQQXZZ
5130: AXQQQ
5131: AXXQQQ
5132:
5133: /^(A(*THEN:A)B|C(*THEN:B)D)/K
5134: AB
5135: CD
5136: ** Failers
5137: AC
5138: CB
5139:
5140: /^(A(*PRUNE:A)B|C(*PRUNE:B)D)/K
5141: AB
5142: CD
5143: ** Failers
5144: AC
5145: CB
5146:
5147: /--- An empty name does not pass back an empty string. It is the same as if no
5148: name were given. ---/
5149:
5150: /^(A(*PRUNE:)B|C(*PRUNE:B)D)/K
5151: AB
5152: CD
5153:
5154: /--- PRUNE goes to next bumpalong; COMMIT does not. ---/
5155:
5156: /A(*PRUNE:A)B/K
5157: ACAB
5158:
5159: /--- Mark names can be duplicated ---/
5160:
5161: /A(*:A)B|X(*:A)Y/K
5162: AABC
5163: XXYZ
5164:
5165: /b(*:m)f|a(*:n)w/K
5166: aw
5167: ** Failers
5168: abc
5169:
5170: /b(*:m)f|aw/K
5171: abaw
5172: ** Failers
5173: abc
5174: abax
5175:
5176: /A(*MARK:A)A+(*SKIP:B)(B|Z) | AAC/xK
5177: AAAC
5178:
5179: /a(*PRUNE:X)bc|qq/KY
5180: ** Failers
5181: axy
5182:
5183: /a(*THEN:X)bc|qq/KY
5184: ** Failers
5185: axy
5186:
5187: /(?=a(*MARK:A)b)..x/K
5188: abxy
5189: ** Failers
5190: abpq
5191:
5192: /(?=a(*MARK:A)b)..(*:Y)x/K
5193: abxy
5194: ** Failers
5195: abpq
5196:
5197: /(?=a(*PRUNE:A)b)..x/K
5198: abxy
5199: ** Failers
5200: abpq
5201:
5202: /(?=a(*PRUNE:A)b)..(*:Y)x/K
5203: abxy
5204: ** Failers
5205: abpq
5206:
5207: /(?=a(*THEN:A)b)..x/K
5208: abxy
5209: ** Failers
5210: abpq
5211:
5212: /(?=a(*THEN:A)b)..(*:Y)x/K
5213: abxy
5214: ** Failers
5215: abpq
5216:
5217: /(another)?(\1?)test/
5218: hello world test
5219:
5220: /(another)?(\1+)test/
5221: hello world test
5222:
1.1.1.3 misho 5223: /(a(*COMMIT)b){0}a(?1)|aac/
5224: aac
5225:
5226: /((?:a?)*)*c/
5227: aac
5228:
5229: /((?>a?)*)*c/
5230: aac
5231:
1.1.1.4 misho 5232: /(?>.*?a)(?<=ba)/
5233: aba
5234:
5235: /(?:.*?a)(?<=ba)/
5236: aba
5237:
5238: /.*?a(*PRUNE)b/
5239: aab
5240:
5241: /.*?a(*PRUNE)b/s
5242: aab
5243:
5244: /^a(*PRUNE)b/s
5245: aab
5246:
5247: /.*?a(*SKIP)b/
5248: aab
5249:
5250: /(?>.*?a)b/s
5251: aab
5252:
5253: /(?>.*?a)b/
5254: aab
5255:
5256: /(?>^a)b/s
5257: aab
5258:
5259: /(?>.*?)(?<=(abcd)|(wxyz))/
5260: alphabetabcd
5261: endingwxyz
5262:
5263: /(?>.*)(?<=(abcd)|(wxyz))/
5264: alphabetabcd
5265: endingwxyz
5266:
5267: "(?>.*)foo"
5268: abcdfooxyz
5269:
5270: "(?>.*?)foo"
5271: abcdfooxyz
5272:
5273: /(?:(a(*PRUNE)b)){0}(?:(?1)|ac)/
5274: ac
5275:
5276: /(?:(a(*SKIP)b)){0}(?:(?1)|ac)/
5277: ac
5278:
5279: /(?<=(*SKIP)ac)a/
5280: aa
5281:
5282: /A(*MARK:A)A+(*SKIP:B)(B|Z) | AC/xK
5283: AAAC
5284:
5285: /a(*SKIP:m)x|ac(*:n)(*SKIP:n)d|ac/K
5286: acacd
5287:
5288: /A(*SKIP:m)x|A(*SKIP:n)x|AB/K
5289: AB
5290:
5291: /((*SKIP:r)d){0}a(*SKIP:m)x|ac(*:n)|ac/K
5292: acacd
5293:
5294: /-- Tests that try to figure out how Perl works. My hypothesis is that the
5295: first verb that is backtracked onto is the one that acts. This seems to be
5296: the case almost all the time, but there is one exception that is perhaps a
5297: bug. --/
5298:
5299: /-- This matches "aaaac"; each PRUNE advances one character until the subject
5300: no longer starts with 5 'a's. --/
5301:
5302: /aaaaa(*PRUNE)b|a+c/
5303: aaaaaac
5304:
5305: /-- Putting SKIP in front of PRUNE makes no difference, as it is never
5306: backtracked onto, whether or not it has a label. --/
5307:
5308: /aaaaa(*SKIP)(*PRUNE)b|a+c/
5309: aaaaaac
5310:
5311: /aaaaa(*SKIP:N)(*PRUNE)b|a+c/
5312: aaaaaac
5313:
5314: /aaaa(*:N)a(*SKIP:N)(*PRUNE)b|a+c/
5315: aaaaaac
5316:
5317: /-- Putting THEN in front makes no difference. */
5318:
5319: /aaaaa(*THEN)(*PRUNE)b|a+c/
5320: aaaaaac
5321:
5322: /-- However, putting COMMIT in front of the prune changes it to "no match". I
5323: think this is inconsistent and possibly a bug. For the moment, running this
5324: test is moved out of the Perl-compatible file. --/
5325:
5326: /aaaaa(*COMMIT)(*PRUNE)b|a+c/
5327:
5328:
5329: /---- OK, lets play the same game again using SKIP instead of PRUNE. ----/
5330:
5331: /-- This matches "ac" because SKIP forces the next match to start on the
5332: sixth "a". --/
5333:
5334: /aaaaa(*SKIP)b|a+c/
5335: aaaaaac
5336:
5337: /-- Putting PRUNE in front makes no difference. --/
5338:
5339: /aaaaa(*PRUNE)(*SKIP)b|a+c/
5340: aaaaaac
5341:
5342: /-- Putting THEN in front makes no difference. --/
5343:
5344: /aaaaa(*THEN)(*SKIP)b|a+c/
5345: aaaaaac
5346:
5347: /-- In this case, neither does COMMIT. This still matches "ac". --/
5348:
5349: /aaaaa(*COMMIT)(*SKIP)b|a+c/
5350: aaaaaac
5351:
5352: /-- This gives "no match", as expected. --/
5353:
5354: /aaaaa(*COMMIT)b|a+c/
5355: aaaaaac
5356:
5357:
5358: /------ Tests using THEN ------/
5359:
5360: /-- This matches "aaaaaac", as expected. --/
5361:
5362: /aaaaa(*THEN)b|a+c/
5363: aaaaaac
5364:
5365: /-- Putting SKIP in front makes no difference. --/
5366:
5367: /aaaaa(*SKIP)(*THEN)b|a+c/
5368: aaaaaac
5369:
5370: /-- Putting PRUNE in front makes no difference. --/
5371:
5372: /aaaaa(*PRUNE)(*THEN)b|a+c/
5373: aaaaaac
5374:
5375: /-- Putting COMMIT in front makes no difference. --/
5376:
5377: /aaaaa(*COMMIT)(*THEN)b|a+c/
5378: aaaaaac
5379:
5380: /-- End of "priority" tests --/
5381:
5382: /aaaaa(*:m)(*PRUNE:m)(*SKIP:m)m|a+/
5383: aaaaaa
5384:
5385: /aaaaa(*:m)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
5386: aaaaaa
5387:
5388: /aaaaa(*:n)(*PRUNE:m)(*SKIP:m)m|a+/
5389: aaaaaa
5390:
5391: /aaaaa(*:n)(*MARK:m)(*PRUNE)(*SKIP:m)m|a+/
5392: aaaaaa
5393:
5394: /a(*MARK:A)aa(*PRUNE:A)a(*SKIP:A)b|a+c/
5395: aaaac
5396:
5397: /a(*MARK:A)aa(*MARK:A)a(*SKIP:A)b|a+c/
5398: aaaac
5399:
5400: /aaa(*PRUNE:A)a(*SKIP:A)b|a+c/
5401: aaaac
5402:
5403: /aaa(*MARK:A)a(*SKIP:A)b|a+c/
5404: aaaac
5405:
5406: /a(*:m)a(*COMMIT)(*SKIP:m)b|a+c/K
5407: aaaaaac
5408:
5409: /.?(a|b(*THEN)c)/
5410: ba
5411:
5412: /(a(*COMMIT)b)c|abd/
5413: abc
5414: abd
5415:
5416: /(?=a(*COMMIT)b)abc|abd/
5417: abc
5418: abd
5419:
5420: /(?>a(*COMMIT)b)c|abd/
5421: abc
5422: abd
5423:
5424: /a(?=b(*COMMIT)c)[^d]|abd/
5425: abd
5426: abc
5427:
5428: /a(?=bc).|abd/
5429: abd
5430: abc
5431:
5432: /a(?>b(*COMMIT)c)d|abd/
5433: abceabd
5434:
5435: /a(?>bc)d|abd/
5436: abceabd
5437:
5438: /(?>a(*COMMIT)b)c|abd/
5439: abd
5440:
5441: /(?>a(*COMMIT)c)d|abd/
5442: abd
5443:
5444: /((?=a(*COMMIT)b)ab|ac){0}(?:(?1)|a(c))/
5445: ac
5446:
5447: /-- These tests were formerly in test 2, but changes in PCRE and Perl have
5448: made them compatible. --/
5449:
5450: /^(a)?(?(1)a|b)+$/
5451: *** Failers
5452: a
5453:
5454: /(?=a\Kb)ab/
5455: ab
5456:
5457: /(?!a\Kb)ac/
5458: ac
5459:
5460: /^abc(?<=b\Kc)d/
5461: abcd
5462:
5463: /^abc(?<!b\Kq)d/
5464: abcd
5465:
5466:
5467: /A(*PRUNE:A)A+(*SKIP:A)(B|Z) | AC/xK
5468: AAAC
5469:
5470: /^((abc|abcx)(*THEN)y|abcd)/
5471: abcd
5472: *** Failers
5473: abcxy
5474:
5475: /^((yes|no)(*THEN)(*F))?/
5476: yes
5477:
5478: /(A (.*) C? (*THEN) | A D) (*FAIL)/x
5479: AbcdCBefgBhiBqz
5480:
5481: /(A (.*) C? (*THEN) | A D) z/x
5482: AbcdCBefgBhiBqz
5483:
5484: /(A (.*) C? (*THEN) | A D) \s* (*FAIL)/x
5485: AbcdCBefgBhiBqz
5486:
5487: /(A (.*) C? (*THEN) | A D) \s* z/x
5488: AbcdCBefgBhiBqz
5489:
5490: /(A (.*) (?:C|) (*THEN) | A D) (*FAIL)/x
5491: AbcdCBefgBhiBqz
5492:
5493: /(A (.*) (?:C|) (*THEN) | A D) z/x
5494: AbcdCBefgBhiBqz
5495:
5496: /(A (.*) C{0,6} (*THEN) | A D) (*FAIL)/x
5497: AbcdCBefgBhiBqz
5498:
5499: /(A (.*) C{0,6} (*THEN) | A D) z/x
5500: AbcdCBefgBhiBqz
5501:
5502: /(A (.*) (CE){0,6} (*THEN) | A D) (*FAIL)/x
5503: AbcdCEBefgBhiBqz
5504:
5505: /(A (.*) (CE){0,6} (*THEN) | A D) z/x
5506: AbcdCEBefgBhiBqz
5507:
5508: /(A (.*) (CE*){0,6} (*THEN) | A D) (*FAIL)/x
5509: AbcdCBefgBhiBqz
5510:
5511: /(A (.*) (CE*){0,6} (*THEN) | A D) z/x
5512: AbcdCBefgBhiBqz
5513:
5514: /(?=a(*COMMIT)b|ac)ac|ac/
5515: ac
5516:
5517: /(?=a(*COMMIT)b|(ac)) ac | (a)c/x
5518: ac
5519:
5520: /--------/
5521:
5522: /(?(?!b(*THEN)a)bn|bnn)/
5523: bnn
5524:
5525: /(?!b(*SKIP)a)bn|bnn/
5526: bnn
5527:
5528: /(?(?!b(*SKIP)a)bn|bnn)/
5529: bnn
5530:
5531: /(?!b(*PRUNE)a)bn|bnn/
5532: bnn
5533:
5534: /(?(?!b(*PRUNE)a)bn|bnn)/
5535: bnn
5536:
5537: /(?!b(*COMMIT)a)bn|bnn/
5538: bnn
5539:
5540: /(?(?!b(*COMMIT)a)bn|bnn)/
5541: bnn
5542:
5543: /(?=b(*SKIP)a)bn|bnn/
5544: bnn
5545:
5546: /(?=b(*THEN)a)bn|bnn/
5547: bnn
5548:
5549: /^(?!a(*SKIP)b)/
5550: ac
5551:
5552: /^(?!a(*SKIP)b)../
5553: acd
5554:
5555: /(?!a(*SKIP)b)../
5556: acd
5557:
5558: /^(?(?!a(*SKIP)b))/
5559: ac
5560:
5561: /^(?!a(*PRUNE)b)../
5562: acd
5563:
5564: /(?!a(*PRUNE)b)../
5565: acd
5566:
5567: /(?!a(*COMMIT)b)ac|cd/
5568: ac
5569:
5570: /\A.*?(?:a|bc)/
5571: ba
5572:
5573: /^(A(*THEN)B|C(*THEN)D)/
5574: CD
5575:
5576: /(*:m(m)(?&y)(?(DEFINE)(?<y>b))/K
5577: abc
5578:
5579: /(*PRUNE:m(m)(?&y)(?(DEFINE)(?<y>b))/K
5580: abc
5581:
5582: /(*SKIP:m(m)(?&y)(?(DEFINE)(?<y>b))/K
5583: abc
5584:
5585: /(*THEN:m(m)(?&y)(?(DEFINE)(?<y>b))/K
5586: abc
5587:
5588: /^\d*\w{4}/
5589: 1234
5590: 123
5591:
5592: /^[^b]*\w{4}/
5593: aaaa
5594: aaa
5595:
5596: /^[^b]*\w{4}/i
5597: aaaa
5598: aaa
5599:
5600: /^a*\w{4}/
5601: aaaa
5602: aaa
5603:
5604: /^a*\w{4}/i
5605: aaaa
5606: aaa
5607:
1.1.1.5 ! misho 5608: /(?(?=ab)ab)/+
! 5609: ca
! 5610: cd
! 5611:
! 5612: /(?:(?<n>foo)|(?<n>bar))\k<n>/J
! 5613: foofoo
! 5614: barbar
! 5615:
! 5616: /(?<n>A)(?:(?<n>foo)|(?<n>bar))\k<n>/J
! 5617: AfooA
! 5618: AbarA
! 5619: ** Failers
! 5620: Afoofoo
! 5621: Abarbar
! 5622:
! 5623: /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
! 5624: 1 IN SOA non-sp1 non-sp2(
! 5625:
! 5626: /^ (?:(?<A>A)|(?'B'B)(?<A>A)) (?('A')x) (?(<B>)y)$/xJ
! 5627: Ax
! 5628: BAxy
! 5629:
! 5630: /^A\xZ/
! 5631: A\0Z
! 5632:
! 5633: /^A\o{123}B/
! 5634: A\123B
! 5635:
! 5636: / ^ a + + b $ /x
! 5637: aaaab
! 5638:
! 5639: / ^ a + #comment
! 5640: + b $ /x
! 5641: aaaab
! 5642:
! 5643: / ^ a + #comment
! 5644: #comment
! 5645: + b $ /x
! 5646: aaaab
! 5647:
! 5648: / ^ (?> a + ) b $ /x
! 5649: aaaab
! 5650:
! 5651: / ^ ( a + ) + + \w $ /x
! 5652: aaaab
! 5653:
! 5654: /(?:a\Kb)*+/+
! 5655: ababc
! 5656:
! 5657: /(?>a\Kb)*/+
! 5658: ababc
! 5659:
! 5660: /(?:a\Kb)*/+
! 5661: ababc
! 5662:
! 5663: /(a\Kb)*+/+
! 5664: ababc
! 5665:
! 5666: /(a\Kb)*/+
! 5667: ababc
! 5668:
1.1 misho 5669: /-- End of testinput1 --/
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>