Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
e9299e6d
Commit
e9299e6d
authored
Sep 24, 2003
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
regexp worked only with the default character set.
Now it can work with any character set.
parent
4e09f14b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
21 deletions
+73
-21
mysql-test/r/func_regexp.result
mysql-test/r/func_regexp.result
+24
-0
mysql-test/t/func_regexp.test
mysql-test/t/func_regexp.test
+14
-0
regex/cclass.h
regex/cclass.h
+1
-0
regex/regcomp.c
regex/regcomp.c
+34
-21
No files found.
mysql-test/r/func_regexp.result
View file @
e9299e6d
...
@@ -52,3 +52,27 @@ select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [
...
@@ -52,3 +52,27 @@ select * from t1 where xxx REGEXP '^this is some text: to test - out\\.reg exp [
xxx
xxx
this is some text: to test - out.reg exp (22/45)
this is some text: to test - out.reg exp (22/45)
drop table t1;
drop table t1;
select _latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin;
_latin1 0xFF regexp _latin1 '[[:lower:]]' COLLATE latin1_bin
1
select _koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin;
_koi8r 0xFF regexp _koi8r '[[:lower:]]' COLLATE koi8r_bin
0
select _latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin;
_latin1 0xFF regexp _latin1 '[[:upper:]]' COLLATE latin1_bin
0
select _koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin;
_koi8r 0xFF regexp _koi8r '[[:upper:]]' COLLATE koi8r_bin
1
select _latin1 0xF7 regexp _latin1 '[[:alpha:]]';
_latin1 0xF7 regexp _latin1 '[[:alpha:]]'
0
select _koi8r 0xF7 regexp _koi8r '[[:alpha:]]';
_koi8r 0xF7 regexp _koi8r '[[:alpha:]]'
1
select _latin1'a' regexp _latin1'A' collate latin1_general_ci;
_latin1'a' regexp _latin1'A' collate latin1_general_ci
1
select _latin1'a' regexp _latin1'A' collate latin1_bin;
_latin1'a' regexp _latin1'A' collate latin1_bin
0
mysql-test/t/func_regexp.test
View file @
e9299e6d
...
@@ -45,3 +45,17 @@ create table t1 (xxx char(128));
...
@@ -45,3 +45,17 @@ create table t1 (xxx char(128));
insert
into
t1
(
xxx
)
values
(
'this is some text: to test - out.reg exp (22/45)'
);
insert
into
t1
(
xxx
)
values
(
'this is some text: to test - out.reg exp (22/45)'
);
select
*
from
t1
where
xxx
REGEXP
'^this is some text: to test - out\\.reg exp [[(][0-9]+[/\\][0-9]+[])][ ]*$'
;
select
*
from
t1
where
xxx
REGEXP
'^this is some text: to test - out\\.reg exp [[(][0-9]+[/\\][0-9]+[])][ ]*$'
;
drop
table
t1
;
drop
table
t1
;
#
# Check with different character sets and collations
#
select
_latin1
0xFF
regexp
_latin1
'[[:lower:]]'
COLLATE
latin1_bin
;
select
_koi8r
0xFF
regexp
_koi8r
'[[:lower:]]'
COLLATE
koi8r_bin
;
select
_latin1
0xFF
regexp
_latin1
'[[:upper:]]'
COLLATE
latin1_bin
;
select
_koi8r
0xFF
regexp
_koi8r
'[[:upper:]]'
COLLATE
koi8r_bin
;
select
_latin1
0xF7
regexp
_latin1
'[[:alpha:]]'
;
select
_koi8r
0xF7
regexp
_koi8r
'[[:alpha:]]'
;
select
_latin1
'a'
regexp
_latin1
'A'
collate
latin1_general_ci
;
select
_latin1
'a'
regexp
_latin1
'A'
collate
latin1_bin
;
regex/cclass.h
View file @
e9299e6d
...
@@ -18,4 +18,5 @@ extern struct cclass {
...
@@ -18,4 +18,5 @@ extern struct cclass {
const
char
*
name
;
const
char
*
name
;
const
char
*
chars
;
const
char
*
chars
;
const
char
*
multis
;
const
char
*
multis
;
uint
mask
;
}
cclasses
[];
}
cclasses
[];
regex/regcomp.c
View file @
e9299e6d
...
@@ -36,19 +36,19 @@ struct parse {
...
@@ -36,19 +36,19 @@ struct parse {
static
char
nuls
[
10
];
/* place to point scanner in event of error */
static
char
nuls
[
10
];
/* place to point scanner in event of error */
struct
cclass
cclasses
[
CCLASS_LAST
+
1
]
=
{
struct
cclass
cclasses
[
CCLASS_LAST
+
1
]
=
{
{
"alnum"
,
""
,
""
},
{
"alnum"
,
""
,
""
,
_U
|
_L
|
_NMR
},
{
"alpha"
,
""
,
""
},
{
"alpha"
,
""
,
""
,
_U
|
_L
},
{
"blank"
,
""
,
""
},
{
"blank"
,
""
,
""
,
_B
},
{
"cntrl"
,
""
,
""
},
{
"cntrl"
,
""
,
""
,
_CTR
},
{
"digit"
,
""
,
""
},
{
"digit"
,
""
,
""
,
_NMR
},
{
"graph"
,
""
,
""
},
{
"graph"
,
""
,
""
,
_PNT
|
_U
|
_L
|
_NMR
},
{
"lower"
,
""
,
""
},
{
"lower"
,
""
,
""
,
_L
},
{
"print"
,
""
,
""
},
{
"print"
,
""
,
""
,
_PNT
|
_U
|
_L
|
_NMR
|
_B
},
{
"punct"
,
""
,
""
},
{
"punct"
,
""
,
""
,
_PNT
},
{
"space"
,
""
,
""
},
{
"space"
,
""
,
""
,
_SPC
},
{
"upper"
,
""
,
""
},
{
"upper"
,
""
,
""
,
_U
},
{
"xdigit"
,
""
,
""
},
{
"xdigit"
,
""
,
""
,
_X
},
{
NULL
,
NULL
,
NULL
}
{
NULL
,
NULL
,
NULL
,
0
}
};
};
/*
/*
...
@@ -747,8 +747,6 @@ register cset *cs;
...
@@ -747,8 +747,6 @@ register cset *cs;
register
char
*
sp
=
p
->
next
;
register
char
*
sp
=
p
->
next
;
register
struct
cclass
*
cp
;
register
struct
cclass
*
cp
;
register
size_t
len
;
register
size_t
len
;
register
char
*
u
;
register
char
c
;
while
(
MORE
()
&&
my_isalpha
(
p
->
charset
,
PEEK
()))
while
(
MORE
()
&&
my_isalpha
(
p
->
charset
,
PEEK
()))
NEXT
();
NEXT
();
...
@@ -762,11 +760,26 @@ register cset *cs;
...
@@ -762,11 +760,26 @@ register cset *cs;
return
;
return
;
}
}
u
=
(
char
*
)
cp
->
chars
;
#ifndef USE_ORIG_REGEX_CODE
{
register
size_t
i
;
for
(
i
=
1
;
i
<
256
;
i
++
)
if
(
p
->
charset
->
ctype
[
i
+
1
]
&
cp
->
mask
)
CHadd
(
cs
,
i
);
}
#else
{
register
char
*
u
=
(
char
*
)
cp
->
chars
;
register
char
c
;
while
((
c
=
*
u
++
)
!=
'\0'
)
while
((
c
=
*
u
++
)
!=
'\0'
)
CHadd
(
cs
,
c
);
CHadd
(
cs
,
c
);
for
(
u
=
(
char
*
)
cp
->
multis
;
*
u
!=
'\0'
;
u
+=
strlen
(
u
)
+
1
)
for
(
u
=
(
char
*
)
cp
->
multis
;
*
u
!=
'\0'
;
u
+=
strlen
(
u
)
+
1
)
MCadd
(
p
,
cs
,
u
);
MCadd
(
p
,
cs
,
u
);
}
#endif
}
}
/*
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment