aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/expected/regex.out
blob: dc0c713b408e4ab46b429e08a855472d0a91ee8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
--
-- Regular expression tests
--
-- Don't want to have to double backslashes in regexes
set standard_conforming_strings = on;
-- Test simple quantified backrefs
select 'bbbbb' ~ '^([bc])\1*$' as t;
 t 
---
 t
(1 row)

select 'ccc' ~ '^([bc])\1*$' as t;
 t 
---
 t
(1 row)

select 'xxx' ~ '^([bc])\1*$' as f;
 f 
---
 f
(1 row)

select 'bbc' ~ '^([bc])\1*$' as f;
 f 
---
 f
(1 row)

select 'b' ~ '^([bc])\1*$' as t;
 t 
---
 t
(1 row)

-- Test quantified backref within a larger expression
select 'abc abc abc' ~ '^(\w+)( \1)+$' as t;
 t 
---
 t
(1 row)

select 'abc abd abc' ~ '^(\w+)( \1)+$' as f;
 f 
---
 f
(1 row)

select 'abc abc abd' ~ '^(\w+)( \1)+$' as f;
 f 
---
 f
(1 row)

select 'abc abc abc' ~ '^(.+)( \1)+$' as t;
 t 
---
 t
(1 row)

select 'abc abd abc' ~ '^(.+)( \1)+$' as f;
 f 
---
 f
(1 row)

select 'abc abc abd' ~ '^(.+)( \1)+$' as f;
 f 
---
 f
(1 row)

-- Test some cases that crashed in 9.2beta1 due to pmatch[] array overrun
select substring('asd TO foo' from ' TO (([a-z0-9._]+|"([^"]+|"")+")+)');
 substring 
-----------
 foo
(1 row)

select substring('a' from '((a))+');
 substring 
-----------
 a
(1 row)

select substring('a' from '((a)+)');
 substring 
-----------
 a
(1 row)