glibc/posix/PCRE.tests
Adhemerval Zanella eb04c21373 posix: Sync gnulib regex implementation
This patch syncs the regex implementation with gnulib (commit 0ee5212).
Only two changes in GLIBC regex testing are required:

  1. posix/bug-regex28.c: as previously discussed [1] the change of
     expected results on the pattern should be safe.

  2. posix/PCRE.tests: the ERE (a)|\1 is malformed (in the sense that
     the \1 doesn't mean anything) and although current GLIBC accepts
     it has undefined behavior.  This patch removes the specific test.

This sync contains some patches from thread 'Regex: Make libc regex
more usable outside GLIBC.' [2] which have been pushed upstream in
gnulib.  This patches also fixes some regex issues (BZ #23233,
BZ #21163, BZ #18986, BZ #13762) and I did not add testcases for
both #23233 and #13762 because I couldn't think a simple way to
trigger the expected failure path to trigger them.

Checked on x86_64-linux-gnu and i686-linux-gnu.

	[BZ #23233]
	[BZ #21163]
	[BZ #18986]
	[BZ #13762]
	* posix/Makefile (tests): Add bug-regex37 and bug-regex38.
	* posix/PCRE.tests: Remove invalid test.
	* posix/bug-regex28.c: Fix expected values for used syntax.
	* posix/bug-regex37.c: New file.
	* posix/bug-regex38.c: Likewise.
	* posix/regcomp.c: Sync with gnulib.
	* posix/regex.c: Likewise.
	* posix/regex.h: Likewise.
	* posix/regex_internal.c: Likewise.
	* posix/regex_internal.h: Likewise.
	* posix/regexec.c: Likewise.

[1] https://sourceware.org/ml/libc-alpha/2017-12/msg00807.html
[2] https://sourceware.org/ml/libc-alpha/2017-12/msg00237.html
2018-07-04 09:54:45 -03:00

2374 lines
25 KiB
Plaintext

# PCRE version 4.4 21-August-2003
# Tests taken from PCRE and modified to suit glibc regex.
#
# PCRE LICENCE
# ------------
#
# PCRE is a library of functions to support regular expressions whose syntax
# and semantics are as close as possible to those of the Perl 5 language.
#
# Written by: Philip Hazel <ph10@cam.ac.uk>
#
# University of Cambridge Computing Service,
# Cambridge, England. Phone: +44 1223 334714.
#
# Copyright (c) 1997-2003 University of Cambridge
#
# Permission is granted to anyone to use this software for any purpose on any
# computer system, and to redistribute it freely, subject to the following
# restrictions:
#
# 1. This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# 2. The origin of this software must not be misrepresented, either by
# explicit claim or by omission. In practice, this means that if you use
# PCRE in software that you distribute to others, commercially or
# otherwise, you must put a sentence like this
#
# Regular expression support is provided by the PCRE library package,
# which is open source software, written by Philip Hazel, and copyright
# by the University of Cambridge, England.
#
# somewhere reasonably visible in your documentation and in any relevant
# files or online help data or similar. A reference to the ftp site for
# the source, that is, to
#
# ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
#
# should also be given in the documentation. However, this condition is not
# intended to apply to whole chains of software. If package A includes PCRE,
# it must acknowledge it, but if package B is software that includes package
# A, the condition is not imposed on package B (unless it uses PCRE
# independently).
#
# 3. Altered versions must be plainly marked as such, and must not be
# misrepresented as being the original software.
#
# 4. If PCRE is embedded in any software that is released under the GNU
# General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
# then the terms of that licence shall supersede any condition above with
# which it is incompatible.
#
# The documentation for PCRE, supplied in the "doc" directory, is distributed
# under the same terms as the software itself.
#
# End
#
/the quick brown fox/
the quick brown fox
0: the quick brown fox
The quick brown FOX
No match
What do you know about the quick brown fox?
0: the quick brown fox
What do you know about THE QUICK BROWN FOX?
No match
/The quick brown fox/i
the quick brown fox
0: the quick brown fox
The quick brown FOX
0: The quick brown FOX
What do you know about the quick brown fox?
0: the quick brown fox
What do you know about THE QUICK BROWN FOX?
0: THE QUICK BROWN FOX
/a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/
abxyzpqrrrabbxyyyypqAzz
0: abxyzpqrrrabbxyyyypqAzz
abxyzpqrrrabbxyyyypqAzz
0: abxyzpqrrrabbxyyyypqAzz
aabxyzpqrrrabbxyyyypqAzz
0: aabxyzpqrrrabbxyyyypqAzz
aaabxyzpqrrrabbxyyyypqAzz
0: aaabxyzpqrrrabbxyyyypqAzz
aaaabxyzpqrrrabbxyyyypqAzz
0: aaaabxyzpqrrrabbxyyyypqAzz
abcxyzpqrrrabbxyyyypqAzz
0: abcxyzpqrrrabbxyyyypqAzz
aabcxyzpqrrrabbxyyyypqAzz
0: aabcxyzpqrrrabbxyyyypqAzz
aaabcxyzpqrrrabbxyyyypAzz
0: aaabcxyzpqrrrabbxyyyypAzz
aaabcxyzpqrrrabbxyyyypqAzz
0: aaabcxyzpqrrrabbxyyyypqAzz
aaabcxyzpqrrrabbxyyyypqqAzz
0: aaabcxyzpqrrrabbxyyyypqqAzz
aaabcxyzpqrrrabbxyyyypqqqAzz
0: aaabcxyzpqrrrabbxyyyypqqqAzz
aaabcxyzpqrrrabbxyyyypqqqqAzz
0: aaabcxyzpqrrrabbxyyyypqqqqAzz
aaabcxyzpqrrrabbxyyyypqqqqqAzz
0: aaabcxyzpqrrrabbxyyyypqqqqqAzz
aaabcxyzpqrrrabbxyyyypqqqqqqAzz
0: aaabcxyzpqrrrabbxyyyypqqqqqqAzz
aaaabcxyzpqrrrabbxyyyypqAzz
0: aaaabcxyzpqrrrabbxyyyypqAzz
abxyzzpqrrrabbxyyyypqAzz
0: abxyzzpqrrrabbxyyyypqAzz
aabxyzzzpqrrrabbxyyyypqAzz
0: aabxyzzzpqrrrabbxyyyypqAzz
aaabxyzzzzpqrrrabbxyyyypqAzz
0: aaabxyzzzzpqrrrabbxyyyypqAzz
aaaabxyzzzzpqrrrabbxyyyypqAzz
0: aaaabxyzzzzpqrrrabbxyyyypqAzz
abcxyzzpqrrrabbxyyyypqAzz
0: abcxyzzpqrrrabbxyyyypqAzz
aabcxyzzzpqrrrabbxyyyypqAzz
0: aabcxyzzzpqrrrabbxyyyypqAzz
aaabcxyzzzzpqrrrabbxyyyypqAzz
0: aaabcxyzzzzpqrrrabbxyyyypqAzz
aaaabcxyzzzzpqrrrabbxyyyypqAzz
0: aaaabcxyzzzzpqrrrabbxyyyypqAzz
aaaabcxyzzzzpqrrrabbbxyyyypqAzz
0: aaaabcxyzzzzpqrrrabbbxyyyypqAzz
aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
0: aaaabcxyzzzzpqrrrabbbxyyyyypqAzz
aaabcxyzpqrrrabbxyyyypABzz
0: aaabcxyzpqrrrabbxyyyypABzz
aaabcxyzpqrrrabbxyyyypABBzz
0: aaabcxyzpqrrrabbxyyyypABBzz
>>>aaabxyzpqrrrabbxyyyypqAzz
0: aaabxyzpqrrrabbxyyyypqAzz
>aaaabxyzpqrrrabbxyyyypqAzz
0: aaaabxyzpqrrrabbxyyyypqAzz
>>>>abcxyzpqrrrabbxyyyypqAzz
0: abcxyzpqrrrabbxyyyypqAzz
*** Failers
No match
abxyzpqrrabbxyyyypqAzz
No match
abxyzpqrrrrabbxyyyypqAzz
No match
abxyzpqrrrabxyyyypqAzz
No match
aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz
No match
aaaabcxyzzzzpqrrrabbbxyyypqAzz
No match
aaabcxyzpqrrrabbxyyyypqqqqqqqAzz
No match
/^(abc){1,2}zz/
abczz
0: abczz
1: abc
abcabczz
0: abcabczz
1: abc
*** Failers
No match
zz
No match
abcabcabczz
No match
>>abczz
No match
/^(b+|a){1,2}c/
bc
0: bc
1: b
bbc
0: bbc
1: bb
bbbc
0: bbbc
1: bbb
bac
0: bac
1: a
bbac
0: bbac
1: a
aac
0: aac
1: a
abbbbbbbbbbbc
0: abbbbbbbbbbbc
1: bbbbbbbbbbb
bbbbbbbbbbbac
0: bbbbbbbbbbbac
1: a
*** Failers
No match
aaac
No match
abbbbbbbbbbbac
No match
/^[]cde]/
]thing
0: ]
cthing
0: c
dthing
0: d
ething
0: e
*** Failers
No match
athing
No match
fthing
No match
/^[^]cde]/
athing
0: a
fthing
0: f
*** Failers
0: *
]thing
No match
cthing
No match
dthing
No match
ething
No match
/^[0-9]+$/
0
0: 0
1
0: 1
2
0: 2
3
0: 3
4
0: 4
5
0: 5
6
0: 6
7
0: 7
8
0: 8
9
0: 9
10
0: 10
100
0: 100
*** Failers
No match
abc
No match
/^.*nter/
enter
0: enter
inter
0: inter
uponter
0: uponter
/^xxx[0-9]+$/
xxx0
0: xxx0
xxx1234
0: xxx1234
*** Failers
No match
xxx
No match
/^.+[0-9][0-9][0-9]$/
x123
0: x123
xx123
0: xx123
123456
0: 123456
*** Failers
No match
123
No match
x1234
0: x1234
/^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/
abc!pqr=apquxz.ixr.zzz.ac.uk
0: abc!pqr=apquxz.ixr.zzz.ac.uk
1: abc
2: pqr
*** Failers
No match
!pqr=apquxz.ixr.zzz.ac.uk
No match
abc!=apquxz.ixr.zzz.ac.uk
No match
abc!pqr=apquxz:ixr.zzz.ac.uk
No match
abc!pqr=apquxz.ixr.zzz.ac.ukk
No match
/:/
Well, we need a colon: somewhere
0: :
*** Fail if we don't
No match
/([0-9a-f:]+)$/i
0abc
0: 0abc
1: 0abc
abc
0: abc
1: abc
fed
0: fed
1: fed
E
0: E
1: E
::
0: ::
1: ::
5f03:12C0::932e
0: 5f03:12C0::932e
1: 5f03:12C0::932e
fed def
0: def
1: def
Any old stuff
0: ff
1: ff
*** Failers
No match
0zzz
No match
gzzz
No match
Any old rubbish
No match
/^.*\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/
.1.2.3
0: .1.2.3
1: 1
2: 2
3: 3
A.12.123.0
0: A.12.123.0
1: 12
2: 123
3: 0
*** Failers
No match
.1.2.3333
No match
1.2.3
No match
1234.2.3
No match
/^([0-9]+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/
1 IN SOA non-sp1 non-sp2(
0: 1 IN SOA non-sp1 non-sp2(
1: 1
2: non-sp1
3: non-sp2
1 IN SOA non-sp1 non-sp2 (
0: 1 IN SOA non-sp1 non-sp2 (
1: 1
2: non-sp1
3: non-sp2
*** Failers
No match
1IN SOA non-sp1 non-sp2(
No match
/^[a-zA-Z0-9][a-zA-Z0-9-]*(\.[a-zA-Z0-9][a-zA-z0-9-]*)*\.$/
a.
0: a.
Z.
0: Z.
2.
0: 2.
ab-c.pq-r.
0: ab-c.pq-r.
1: .pq-r
sxk.zzz.ac.uk.
0: sxk.zzz.ac.uk.
1: .uk
x-.y-.
0: x-.y-.
1: .y-
*** Failers
No match
-abc.peq.
No match
/^\*\.[a-z]([a-z0-9-]*[a-z0-9]+)?(\.[a-z]([a-z0-9-]*[a-z0-9]+)?)*$/
*.a
0: *.a
*.b0-a
0: *.b0-a
1: 0-a
*.c3-b.c
0: *.c3-b.c
1: 3-b
2: .c
*.c-a.b-c
0: *.c-a.b-c
1: -a
2: .b-c
3: -c
*** Failers
No match
*.0
No match
*.a-
No match
*.a-b.c-
No match
*.c-a.0-c
No match
/^[0-9a-f](\.[0-9a-f])*$/i
a.b.c.d
0: a.b.c.d
1: .d
A.B.C.D
0: A.B.C.D
1: .D
a.b.c.1.2.3.C
0: a.b.c.1.2.3.C
1: .C
/^".*"\s*(;.*)?$/
"1234"
0: "1234"
"abcd" ;
0: "abcd" ;
1: ;
"" ; rhubarb
0: "" ; rhubarb
1: ; rhubarb
*** Failers
No match
"1234" : things
No match
/^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/
abcdefhijklm
0: abcdefhijklm
1: abc
2: bc
3: c
4: def
5: ef
6: f
7: hij
8: ij
9: j
10: klm
11: lm
12: m
/^a*\w/
z
0: z
az
0: az
aaaz
0: aaaz
a
0: a
aa
0: aa
aaaa
0: aaaa
a+
0: a
aa+
0: aa
/^a+\w/
az
0: az
aaaz
0: aaaz
aa
0: aa
aaaa
0: aaaa
aa+
0: aa
/^[0-9]{8}\w{2,}/
1234567890
0: 1234567890
12345678ab
0: 12345678ab
12345678__
0: 12345678__
*** Failers
No match
1234567
No match
/^[aeiou0-9]{4,5}$/
uoie
0: uoie
1234
0: 1234
12345
0: 12345
aaaaa
0: aaaaa
*** Failers
No match
123456
No match
/\`(abc|def)=(\1){2,3}\'/
abc=abcabc
0: abc=abcabc
1: abc
2: abc
def=defdefdef
0: def=defdefdef
1: def
2: def
*** Failers
No match
abc=defdef
No match
/(cat(a(ract|tonic)|erpillar)) \1()2(3)/
cataract cataract23
0: cataract cataract23
1: cataract
2: aract
3: ract
4:
5: 3
catatonic catatonic23
0: catatonic catatonic23
1: catatonic
2: atonic
3: tonic
4:
5: 3
caterpillar caterpillar23
0: caterpillar caterpillar23
1: caterpillar
2: erpillar
3: <unset>
4:
5: 3
/^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]/
From abcd Mon Sep 01 12:33:02 1997
0: From abcd Mon Sep 01 12:33
1: abcd
/^From\s+\S+\s+([a-zA-Z]{3}\s+){2}[0-9]{1,2}\s+[0-9][0-9]:[0-9][0-9]/
From abcd Mon Sep 01 12:33:02 1997
0: From abcd Mon Sep 01 12:33
1: Sep
From abcd Mon Sep 1 12:33:02 1997
0: From abcd Mon Sep 1 12:33
1: Sep
*** Failers
No match
From abcd Sep 01 12:33:02 1997
No match
/^(a)\1{2,3}(.)/
aaab
0: aaab
1: a
2: b
aaaab
0: aaaab
1: a
2: b
aaaaab
0: aaaaa
1: a
2: a
aaaaaab
0: aaaaa
1: a
2: a
/^[ab]{1,3}(ab*|b)/
aabbbbb
0: aabbbbb
1: abbbbb
/^(cow|)\1(bell)/
cowcowbell
0: cowcowbell
1: cow
2: bell
bell
0: bell
1:
2: bell
*** Failers
No match
cowbell
No match
/^(a|)\1+b/
aab
0: aab
1: a
aaaab
0: aaaab
1: a
b
0: b
1:
*** Failers
No match
ab
No match
/^(a|)\1{2}b/
aaab
0: aaab
1: a
b
0: b
1:
*** Failers
No match
ab
No match
aab
No match
aaaab
No match
/^(a|)\1{2,3}b/
aaab
0: aaab
1: a
aaaab
0: aaaab
1: a
b
0: b
1:
*** Failers
No match
ab
No match
aab
No match
aaaaab
No match
/ab{1,3}bc/
abbbbc
0: abbbbc
abbbc
0: abbbc
abbc
0: abbc
*** Failers
No match
abc
No match
abbbbbc
No match
/([^.]*)\.([^:]*):[T ]+(.*)/
track1.title:TBlah blah blah
0: track1.title:TBlah blah blah
1: track1
2: title
3: Blah blah blah
/([^.]*)\.([^:]*):[T ]+(.*)/i
track1.title:TBlah blah blah
0: track1.title:TBlah blah blah
1: track1
2: title
3: Blah blah blah
/([^.]*)\.([^:]*):[t ]+(.*)/i
track1.title:TBlah blah blah
0: track1.title:TBlah blah blah
1: track1
2: title
3: Blah blah blah
/^abc$/
abc
0: abc
*** Failers
No match
/[-az]+/
az-
0: az-
*** Failers
0: a
b
No match
/[az-]+/
za-
0: za-
*** Failers
0: a
b
No match
/[a-z]+/
abcdxyz
0: abcdxyz
/[0-9-]+/
12-34
0: 12-34
*** Failers
No match
aaa
No match
/(abc)\1/i
abcabc
0: abcabc
1: abc
ABCabc
0: ABCabc
1: ABC
abcABC
0: abcABC
1: abc
/a{0}bc/
bc
0: bc
/^([^a])([^b])([^c]*)([^d]{3,4})/
baNOTccccd
0: baNOTcccc
1: b
2: a
3: NOT
4: cccc
baNOTcccd
0: baNOTccc
1: b
2: a
3: NOT
4: ccc
baNOTccd
0: baNOTcc
1: b
2: a
3: NO
4: Tcc
bacccd
0: baccc
1: b
2: a
3:
4: ccc
*** Failers
0: *** Failers
1: *
2: *
3: * Fail
4: ers
anything
No match
baccd
No match
/[^a]/
Abc
0: A
/[^a]/i
Abc
0: b
/[^a]+/
AAAaAbc
0: AAA
/[^a]+/i
AAAaAbc
0: bc
/[^k]$/
abc
0: c
*** Failers
0: s
abk
No match
/[^k]{2,3}$/
abc
0: abc
kbc
0: bc
kabc
0: abc
*** Failers
0: ers
abk
No match
akb
No match
akk
No match
/^[0-9]{8,}@.+[^k]$/
12345678@a.b.c.d
0: 12345678@a.b.c.d
123456789@x.y.z
0: 123456789@x.y.z
*** Failers
No match
12345678@x.y.uk
No match
1234567@a.b.c.d
No match
/(a)\1{8,}/
aaaaaaaaa
0: aaaaaaaaa
1: a
aaaaaaaaaa
0: aaaaaaaaaa
1: a
*** Failers
No match
aaaaaaa
No match
/[^a]/
aaaabcd
0: b
aaAabcd
0: A
/[^a]/i
aaaabcd
0: b
aaAabcd
0: b
/[^az]/
aaaabcd
0: b
aaAabcd
0: A
/[^az]/i
aaaabcd
0: b
aaAabcd
0: b
/P[^*]TAIRE[^*]{1,6}LL/
xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
0: PSTAIREISLL
/P[^*]TAIRE[^*]{1,}LL/
xxxxxxxxxxxPSTAIREISLLxxxxxxxxx
0: PSTAIREISLL
/(\.[0-9][0-9][1-9]?)[0-9]+/
1.230003938
0: .230003938
1: .23
1.875000282
0: .875000282
1: .875
1.235
0: .235
1: .23
/\b(foo)\s+(\w+)/i
Food is on the foo table
0: foo table
1: foo
2: table
/foo(.*)bar/
The food is under the bar in the barn.
0: food is under the bar in the bar
1: d is under the bar in the
/(.*)([0-9]*)/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
1: I have 2 numbers: 53147
2:
/(.*)([0-9]+)/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
1: I have 2 numbers: 5314
2: 7
/(.*)([0-9]+)$/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
1: I have 2 numbers: 5314
2: 7
/(.*)\b([0-9]+)$/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
1: I have 2 numbers:
2: 53147
/(.*[^0-9])([0-9]+)$/
I have 2 numbers: 53147
0: I have 2 numbers: 53147
1: I have 2 numbers:
2: 53147
/[[:digit:]][[:digit:]]\/[[:digit:]][[:digit:]]\/[[:digit:]][[:digit:]][[:digit:]][[:digit:]]/
01/01/2000
0: 01/01/2000
/^(a){0,0}/
bcd
0:
abc
0:
aab
0:
/^(a){0,1}/
bcd
0:
abc
0: a
1: a
aab
0: a
1: a
/^(a){0,2}/
bcd
0:
abc
0: a
1: a
aab
0: aa
1: a
/^(a){0,3}/
bcd
0:
abc
0: a
1: a
aab
0: aa
1: a
aaa
0: aaa
1: a
/^(a){0,}/
bcd
0:
abc
0: a
1: a
aab
0: aa
1: a
aaa
0: aaa
1: a
aaaaaaaa
0: aaaaaaaa
1: a
/^(a){1,1}/
bcd
No match
abc
0: a
1: a
aab
0: a
1: a
/^(a){1,2}/
bcd
No match
abc
0: a
1: a
aab
0: aa
1: a
/^(a){1,3}/
bcd
No match
abc
0: a
1: a
aab
0: aa
1: a
aaa
0: aaa
1: a
/^(a){1,}/
bcd
No match
abc
0: a
1: a
aab
0: aa
1: a
aaa
0: aaa
1: a
aaaaaaaa
0: aaaaaaaa
1: a
/^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/
123456654321
0: 123456654321
/^[[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]][[:digit:]]/
123456654321
0: 123456654321
/^[abc]{12}/
abcabcabcabc
0: abcabcabcabc
/^[a-c]{12}/
abcabcabcabc
0: abcabcabcabc
/^(a|b|c){12}/
abcabcabcabc
0: abcabcabcabc
1: c
/^[abcdefghijklmnopqrstuvwxy0123456789]/
n
0: n
*** Failers
No match
z
No match
/abcde{0,0}/
abcd
0: abcd
*** Failers
No match
abce
No match
/ab[cd]{0,0}e/
abe
0: abe
*** Failers
No match
abcde
No match
/ab(c){0,0}d/
abd
0: abd
*** Failers
No match
abcd
No match
/a(b*)/
a
0: a
1:
ab
0: ab
1: b
abbbb
0: abbbb
1: bbbb
*** Failers
0: a
1:
bbbbb
No match
/ab[0-9]{0}e/
abe
0: abe
*** Failers
No match
ab1e
No match
/(A|B)*CD/
CD
0: CD
/(AB)*\1/
ABABAB
0: ABABAB
1: AB
/([0-9]+)(\w)/
12345a
0: 12345a
1: 12345
2: a
12345+
0: 12345
1: 1234
2: 5
/(abc|)+/
abc
0: abc
1: abc
abcabc
0: abcabc
1: abc
abcabcabc
0: abcabcabc
1: abc
xyz
0:
1:
/([a]*)*/
a
0: a
1: a
aaaaa
0: aaaaa
1: aaaaa
/([ab]*)*/
a
0: a
1: a
b
0: b
1: b
ababab
0: ababab
1: ababab
aaaabcde
0: aaaab
1: aaaab
bbbb
0: bbbb
1: bbbb
/([^a]*)*/
b
0: b
1: b
bbbb
0: bbbb
1: bbbb
aaa
0:
/([^ab]*)*/
cccc
0: cccc
1: cccc
abab
0:
/abc/
abc
0: abc
xabcy
0: abc
ababc
0: abc
*** Failers
No match
xbc
No match
axc
No match
abx
No match
/ab*c/
abc
0: abc
/ab*bc/
abc
0: abc
abbc
0: abbc
abbbbc
0: abbbbc
/.{1}/
abbbbc
0: a
/.{3,4}/
abbbbc
0: abbb
/ab{0,}bc/
abbbbc
0: abbbbc
/ab+bc/
abbc
0: abbc
*** Failers
No match
abc
No match
abq
No match
/ab+bc/
abbbbc
0: abbbbc
/ab{1,}bc/
abbbbc
0: abbbbc
/ab{1,3}bc/
abbbbc
0: abbbbc
/ab{3,4}bc/
abbbbc
0: abbbbc
/ab{4,5}bc/
*** Failers
No match
abq
No match
abbbbc
No match
/ab?bc/
abbc
0: abbc
abc
0: abc
/ab{0,1}bc/
abc
0: abc
/ab?c/
abc
0: abc
/ab{0,1}c/
abc
0: abc
/^abc$/
abc
0: abc
*** Failers
No match
abbbbc
No match
abcc
No match
/^abc/
abcc
0: abc
/abc$/
aabc
0: abc
*** Failers
No match
aabc
0: abc
aabcd
No match
/^/
abc
0:
/$/
abc
0:
/a.c/
abc
0: abc
axc
0: axc
/a.*c/
axyzc
0: axyzc
/a[bc]d/
abd
0: abd
*** Failers
No match
axyzd
No match
abc
No match
/a[b-d]e/
ace
0: ace
/a[b-d]/
aac
0: ac
/a[-b]/
a-
0: a-
/a[b-]/
a-
0: a-
/a[]]b/
a]b
0: a]b
/a[^bc]d/
aed
0: aed
*** Failers
No match
abd
No match
abd
No match
/a[^-b]c/
adc
0: adc
/a[^]b]c/
adc
0: adc
*** Failers
No match
a-c
0: a-c
a]c
No match
/\ba\b/
a-
0: a
-a
0: a
-a-
0: a
/\by\b/
*** Failers
No match
xy
No match
yz
No match
xyz
No match
/\Ba\B/
*** Failers
0: a
a-
No match
-a
No match
-a-
No match
/\By\b/
xy
0: y
/\by\B/
yz
0: y
/\By\B/
xyz
0: y
/\w/
a
0: a
/\W/
-
0: -
*** Failers
0: *
-
0: -
a
No match
/a\sb/
a b
0: a b
/a\Sb/
a-b
0: a-b
*** Failers
No match
a-b
0: a-b
a b
No match
/[0-9]/
1
0: 1
/[^0-9]/
-
0: -
*** Failers
0: *
-
0: -
1
No match
/ab|cd/
abc
0: ab
abcd
0: ab
/()ef/
def
0: ef
1:
/a\(b/
a(b
0: a(b
/a\(*b/
ab
0: ab
a((b
0: a((b
/((a))/
abc
0: a
1: a
2: a
/(a)b(c)/
abc
0: abc
1: a
2: c
/a+b+c/
aabbabc
0: abc
/a{1,}b{1,}c/
aabbabc
0: abc
/(a+|b)*/
ab
0: ab
1: b
/(a+|b){0,}/
ab
0: ab
1: b
/(a+|b)+/
ab
0: ab
1: b
/(a+|b){1,}/
ab
0: ab
1: b
/(a+|b)?/
ab
0: a
1: a
/(a+|b){0,1}/
ab
0: a
1: a
/[^ab]*/
cde
0: cde
/abc/
*** Failers
No match
b
No match
/a*/
/([abc])*d/
abbbcd
0: abbbcd
1: c
/([abc])*bcd/
abcd
0: abcd
1: a
/a|b|c|d|e/
e
0: e
/(a|b|c|d|e)f/
ef
0: ef
1: e
/abcd*efg/
abcdefg
0: abcdefg
/ab*/
xabyabbbz
0: ab
xayabbbz
0: a
/(ab|cd)e/
abcde
0: cde
1: cd
/[abhgefdc]ij/
hij
0: hij
/(abc|)ef/
abcdef
0: ef
1:
/(a|b)c*d/
abcd
0: bcd
1: b
/(ab|ab*)bc/
abc
0: abc
1: a
/a([bc]*)c*/
abc
0: abc
1: bc
/a([bc]*)(c*d)/
abcd
0: abcd
1: bc
2: d
/a([bc]+)(c*d)/
abcd
0: abcd
1: bc
2: d
/a([bc]*)(c+d)/
abcd
0: abcd
1: b
2: cd
/a[bcd]*dcdcde/
adcdcde
0: adcdcde
/a[bcd]+dcdcde/
*** Failers
No match
abcde
No match
adcdcde
No match
/(ab|a)b*c/
abc
0: abc
1: ab
/((a)(b)c)(d)/
abcd
0: abcd
1: abc
2: a
3: b
4: d
/[a-zA-Z_][a-zA-Z0-9_]*/
alpha
0: alpha
/^a(bc+|b[eh])g|.h$/
abh
0: bh
/(bc+d$|ef*g.|h?i(j|k))/
effgz
0: effgz
1: effgz
ij
0: ij
1: ij
2: j
reffgz
0: effgz
1: effgz
*** Failers
No match
effg
No match
bcdd
No match
/((((((((((a))))))))))/
a
0: a
1: a
2: a
3: a
4: a
5: a
6: a
7: a
8: a
9: a
10: a
/((((((((((a))))))))))\9/
aa
0: aa
1: a
2: a
3: a
4: a
5: a
6: a
7: a
8: a
9: a
10: a
/(((((((((a)))))))))/
a
0: a
1: a
2: a
3: a
4: a
5: a
6: a
7: a
8: a
9: a
/multiple words of text/
*** Failers
No match
aa
No match
uh-uh
No match
/multiple words/
multiple words, yeah
0: multiple words
/(.*)c(.*)/
abcde
0: abcde
1: ab
2: de
/\((.*), (.*)\)/
(a, b)
0: (a, b)
1: a
2: b
/abcd/
abcd
0: abcd
/a(bc)d/
abcd
0: abcd
1: bc
/a[-]?c/
ac
0: ac
/(abc)\1/
abcabc
0: abcabc
1: abc
/([a-c]*)\1/
abcabc
0: abcabc
1: abc
/abc/i
ABC
0: ABC
XABCY
0: ABC
ABABC
0: ABC
*** Failers
No match
aaxabxbaxbbx
No match
XBC
No match
AXC
No match
ABX
No match
/ab*c/i
ABC
0: ABC
/ab*bc/i
ABC
0: ABC
ABBC
0: ABBC
/ab+bc/i
*** Failers
No match
ABC
No match
ABQ
No match
/ab+bc/i
ABBBBC
0: ABBBBC
/^abc$/i
ABC
0: ABC
*** Failers
No match
ABBBBC
No match
ABCC
No match
/^abc/i
ABCC
0: ABC
/abc$/i
AABC
0: ABC
/^/i
ABC
0:
/$/i
ABC
0:
/a.c/i
ABC
0: ABC
AXC
0: AXC
/a.*c/i
*** Failers
No match
AABC
0: AABC
AXYZD
No match
/a[bc]d/i
ABD
0: ABD
/a[b-d]e/i
ACE
0: ACE
*** Failers
No match
ABC
No match
ABD
No match
/a[b-d]/i
AAC
0: AC
/a[-b]/i
A-
0: A-
/a[b-]/i
A-
0: A-
/a[]]b/i
A]B
0: A]B
/a[^bc]d/i
AED
0: AED
/a[^-b]c/i
ADC
0: ADC
*** Failers
No match
ABD
No match
A-C
No match
/a[^]b]c/i
ADC
0: ADC
/ab|cd/i
ABC
0: AB
ABCD
0: AB
/()ef/i
DEF
0: EF
1:
/$b/i
*** Failers
No match
A]C
No match
B
No match
/a\(b/i
A(B
0: A(B
/a\(*b/i
AB
0: AB
A((B
0: A((B
/((a))/i
ABC
0: A
1: A
2: A
/(a)b(c)/i
ABC
0: ABC
1: A
2: C
/a+b+c/i
AABBABC
0: ABC
/a{1,}b{1,}c/i
AABBABC
0: ABC
/(a+|b)*/i
AB
0: AB
1: B
/(a+|b){0,}/i
AB
0: AB
1: B
/(a+|b)+/i
AB
0: AB
1: B
/(a+|b){1,}/i
AB
0: AB
1: B
/(a+|b)?/i
AB
0: A
1: A
/(a+|b){0,1}/i
AB
0: A
1: A
/[^ab]*/i
CDE
0: CDE
/([abc])*d/i
ABBBCD
0: ABBBCD
1: C
/([abc])*bcd/i
ABCD
0: ABCD
1: A
/a|b|c|d|e/i
E
0: E
/(a|b|c|d|e)f/i
EF
0: EF
1: E
/abcd*efg/i
ABCDEFG
0: ABCDEFG
/ab*/i
XABYABBBZ
0: AB
XAYABBBZ
0: A
/(ab|cd)e/i
ABCDE
0: CDE
1: CD
/[abhgefdc]ij/i
HIJ
0: HIJ
/^(ab|cd)e/i
ABCDE
No match
/(abc|)ef/i
ABCDEF
0: EF
1:
/(a|b)c*d/i
ABCD
0: BCD
1: B
/(ab|ab*)bc/i
ABC
0: ABC
1: A
/a([bc]*)c*/i
ABC
0: ABC
1: BC
/a([bc]*)(c*d)/i
ABCD
0: ABCD
1: BC
2: D
/a([bc]+)(c*d)/i
ABCD
0: ABCD
1: BC
2: D
/a([bc]*)(c+d)/i
ABCD
0: ABCD
1: B
2: CD
/a[bcd]*dcdcde/i
ADCDCDE
0: ADCDCDE
/a[bcd]+dcdcde/i
/(ab|a)b*c/i
ABC
0: ABC
1: AB
/((a)(b)c)(d)/i
ABCD
0: ABCD
1: ABC
2: A
3: B
4: D
/[a-zA-Z_][a-zA-Z0-9_]*/i
ALPHA
0: ALPHA
/^a(bc+|b[eh])g|.h$/i
ABH
0: BH
/(bc+d$|ef*g.|h?i(j|k))/i
EFFGZ
0: EFFGZ
1: EFFGZ
IJ
0: IJ
1: IJ
2: J
REFFGZ
0: EFFGZ
1: EFFGZ
*** Failers
No match
ADCDCDE
No match
EFFG
No match
BCDD
No match
/((((((((((a))))))))))/i
A
0: A
1: A
2: A
3: A
4: A
5: A
6: A
7: A
8: A
9: A
10: A
/((((((((((a))))))))))\9/i
AA
0: AA
1: A
2: A
3: A
4: A
5: A
6: A
7: A
8: A
9: A
10: A
/(((((((((a)))))))))/i
A
0: A
1: A
2: A
3: A
4: A
5: A
6: A
7: A
8: A
9: A
/multiple words of text/i
*** Failers
No match
AA
No match
UH-UH
No match
/multiple words/i
MULTIPLE WORDS, YEAH
0: MULTIPLE WORDS
/(.*)c(.*)/i
ABCDE
0: ABCDE
1: AB
2: DE
/\((.*), (.*)\)/i
(A, B)
0: (A, B)
1: A
2: B
/abcd/i
ABCD
0: ABCD
/a(bc)d/i
ABCD
0: ABCD
1: BC
/a[-]?c/i
AC
0: AC
/(abc)\1/i
ABCABC
0: ABCABC
1: ABC
/([a-c]*)\1/i
ABCABC
0: ABCABC
1: ABC
/((foo)|(bar))*/
foobar
0: foobar
1: bar
2: foo
3: bar
/^(.+)?B/
AB
0: AB
1: A
/^([^a-z])|(\^)$/
.
0: .
1: .
/^[<>]&/
<&OUT
0: <&
/^(){3,5}/
abc
0:
1:
/^(a+)*ax/
aax
0: aax
1: a
/^((a|b)+)*ax/
aax
0: aax
1: a
2: a
/^((a|bc)+)*ax/
aax
0: aax
1: a
2: a
/(a|x)*ab/
cab
0: ab
/(a)*ab/
cab
0: ab
/(ab)[0-9]\1/i
Ab4ab
0: Ab4ab
1: Ab
ab4Ab
0: ab4Ab
1: ab
/foo\w*[0-9]{4}baz/
foobar1234baz
0: foobar1234baz
/(\w+:)+/
one:
0: one:
1: one:
/((\w|:)+::)?(\w+)$/
abcd
0: abcd
1: <unset>
2: <unset>
3: abcd
xy:z:::abcd
0: xy:z:::abcd
1: xy:z:::
2: :
3: abcd
/^[^bcd]*(c+)/
aexycd
0: aexyc
1: c
/(a*)b+/
caab
0: aab
1: aa
/((\w|:)+::)?(\w+)$/
abcd
0: abcd
1: <unset>
2: <unset>
3: abcd
xy:z:::abcd
0: xy:z:::abcd
1: xy:z:::
2: :
3: abcd
*** Failers
0: Failers
1: <unset>
2: <unset>
3: Failers
abcd:
No match
abcd:
No match
/^[^bcd]*(c+)/
aexycd
0: aexyc
1: c
/((Z)+|A)*/
ZABCDEFG
0: ZA
1: A
2: Z
/(Z()|A)*/
ZABCDEFG
0: ZA
1: A
2:
/(Z(())|A)*/
ZABCDEFG
0: ZA
1: A
2:
3:
/(.*)[0-9]+\1/
abc123abc
0: abc123abc
1: abc
abc123bc
0: bc123bc
1: bc
/((.*))[0-9]+\1/
abc123abc
0: abc123abc
1: abc
2: abc
abc123bc
0: bc123bc
1: bc
2: bc
/^a{2,5}$/
aa
0: aa
aaa
0: aaa
aaaa
0: aaaa
aaaaa
0: aaaaa
*** Failers
No match
a
No match
b
No match
aaaaab
No match
aaaaaa