1
by brian
clean slate |
1 |
drop table if exists t1; |
2 |
set names latin1; |
|
3 |
drop table if exists t1; |
|
4 |
create table t1 as |
|
5 |
select repeat(' ', 64) as s1, repeat(' ',64) as s2 |
|
6 |
union
|
|
7 |
select null, null; |
|
8 |
show create table t1; |
|
9 |
Table Create Table |
|
10 |
t1 CREATE TABLE "t1" ( |
|
11 |
"s1" varchar(64), |
|
12 |
"s2" varchar(64) |
|
13 |
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
|
14 |
delete from t1; |
|
15 |
insert into t1 values('aaa','aaa'); |
|
16 |
insert into t1 values('aaa|qqq','qqq'); |
|
17 |
insert into t1 values('gheis','^[^a-dXYZ]+$'); |
|
18 |
insert into t1 values('aab','^aa?b'); |
|
19 |
insert into t1 values('Baaan','^Ba*n'); |
|
20 |
insert into t1 values('aaa','qqq|aaa'); |
|
21 |
insert into t1 values('qqq','qqq|aaa'); |
|
22 |
insert into t1 values('bbb','qqq|aaa'); |
|
23 |
insert into t1 values('bbb','qqq'); |
|
24 |
insert into t1 values('aaa','aba'); |
|
25 |
insert into t1 values(null,'abc'); |
|
26 |
insert into t1 values('def',null); |
|
27 |
insert into t1 values(null,null); |
|
28 |
insert into t1 values('ghi','ghi['); |
|
29 |
select HIGH_PRIORITY s1 regexp s2 from t1; |
|
30 |
s1 regexp s2 |
|
31 |
1
|
|
32 |
1
|
|
33 |
1
|
|
34 |
1
|
|
35 |
1
|
|
36 |
1
|
|
37 |
1
|
|
38 |
0
|
|
39 |
0
|
|
40 |
0
|
|
41 |
NULL
|
|
42 |
NULL
|
|
43 |
NULL
|
|
44 |
NULL
|
|
45 |
drop table t1; |
|
46 |
create table t1 (xxx char(128)); |
|
47 |
insert into t1 (xxx) values('this is a test of some long text to see what happens'); |
|
48 |
select * from t1 where xxx regexp('is a test of some long text to'); |
|
49 |
xxx
|
|
50 |
this is a test of some long text to see what happens |
|
51 |
explain extended select * from t1 where xxx regexp('is a test of some long text to'); |
|
52 |
id select_type table type possible_keys key key_len ref rows filtered Extra |
|
53 |
1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 |
|
54 |
Warnings: |
|
55 |
Note 1003 select 'this is a test of some long text to see what happens' AS "xxx" from "test"."t1" where ('this is a test of some long text to see what happens' regexp 'is a test of some long text to') |
|
56 |
select * from t1 where xxx regexp('is a test of some long text to '); |
|
57 |
xxx
|
|
58 |
this is a test of some long text to see what happens |
|
59 |
select * from t1 where xxx regexp('is a test of some long text to s'); |
|
60 |
xxx
|
|
61 |
this is a test of some long text to see what happens |
|
62 |
select * from t1 where xxx regexp('is a test of some long text to se'); |
|
63 |
xxx
|
|
64 |
this is a test of some long text to see what happens |
|
65 |
drop table t1; |
|
66 |
create table t1 (xxx char(128)); |
|
67 |
insert into t1 (xxx) values('this is some text: to test - out.reg exp (22/45)'); |
|
68 |
select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [[(][0-9]+[/\\][0-9]+[])][ ]*$'; |
|
69 |
xxx
|
|
70 |
this is some text: to test - out.reg exp (22/45) |
|
71 |
drop table t1; |
|
72 |
select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin; |
|
73 |
_latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin |
|
74 |
1
|
|
75 |
select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin; |
|
76 |
_koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin |
|
77 |
0
|
|
78 |
select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin; |
|
79 |
_latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin |
|
80 |
0
|
|
81 |
select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin; |
|
82 |
_koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin |
|
83 |
1
|
|
84 |
select _latin1 0xF7 regexp _latin1 '[[:alpha:]]'; |
|
85 |
_latin1 0xF7 regexp _latin1 '[[:alpha:]]' |
|
86 |
0
|
|
87 |
select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]'; |
|
88 |
_koi8r 0xF7 regexp _koi8r '[[:alpha:]]' |
|
89 |
1
|
|
90 |
select _latin1'a' regexp _latin1'A' collate latin1_general_ci; |
|
91 |
_latin1'a' regexp _latin1'A' collate latin1_general_ci |
|
92 |
1
|
|
93 |
select _latin1'a' regexp _latin1'A' collate latin1_bin; |
|
94 |
_latin1'a' regexp _latin1'A' collate latin1_bin |
|
95 |
0
|
|
96 |
End of 4.1 tests |
|
97 |
SELECT 1 REGEXP NULL; |
|
98 |
1 REGEXP NULL |
|
99 |
NULL
|
|
100 |
End of 5.0 tests |