mirror of
https://github.com/MariaDB/server.git
synced 2025-01-19 13:32:33 +01:00
manual.texi fix tutorial examples that become incorrect when
manual.texi REGEXP became case insensitive.
This commit is contained in:
parent
2165d185b7
commit
dec736400a
1 changed files with 21 additions and 5 deletions
|
@ -24782,10 +24782,10 @@ To demonstrate how extended regular expressions work, the @code{LIKE} queries
|
|||
shown above are rewritten below to use @code{REGEXP}.
|
||||
|
||||
To find names beginning with @samp{b}, use @samp{^} to match the beginning of
|
||||
the name and @samp{[bB]} to match either lowercase or uppercase @samp{b}:
|
||||
the name:
|
||||
|
||||
@example
|
||||
mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
|
||||
mysql> SELECT * FROM pet WHERE name REGEXP "^b";
|
||||
+--------+--------+---------+------+------------+------------+
|
||||
| name | owner | species | sex | birth | death |
|
||||
+--------+--------+---------+------+------------+------------+
|
||||
|
@ -24794,6 +24794,23 @@ mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
|
|||
+--------+--------+---------+------+------------+------------+
|
||||
@end example
|
||||
|
||||
Prior to MySQL 3.23.4, @code{REGEXP} is case sensitive, and the previous
|
||||
query will return no rows. To match either lowercase or uppercase @samp{b},
|
||||
use this query instead:
|
||||
|
||||
@example
|
||||
mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
|
||||
@end example
|
||||
|
||||
From MySQL 3.23.4 on, to force a @code{REGEXP} comparison to be case
|
||||
sensitive, use the @code{BINARY} keyword to make one of the strings a
|
||||
binary string. This query will match only lowercase @samp{b} at the
|
||||
beginning of a name:
|
||||
|
||||
@example
|
||||
mysql> SELECT * FROM pet WHERE name REGEXP BINARY "^b";
|
||||
@end example
|
||||
|
||||
To find names ending with @samp{fy}, use @samp{$} to match the end of the
|
||||
name:
|
||||
|
||||
|
@ -24807,11 +24824,10 @@ mysql> SELECT * FROM pet WHERE name REGEXP "fy$";
|
|||
+--------+--------+---------+------+------------+-------+
|
||||
@end example
|
||||
|
||||
To find names containing a @samp{w}, use
|
||||
@samp{[wW]} to match either lowercase or uppercase @samp{w}:
|
||||
To find names containing a lowercase or uppercase @samp{w}, use this query:
|
||||
|
||||
@example
|
||||
mysql> SELECT * FROM pet WHERE name REGEXP "[wW]";
|
||||
mysql> SELECT * FROM pet WHERE name REGEXP "w";
|
||||
+----------+-------+---------+------+------------+------------+
|
||||
| name | owner | species | sex | birth | death |
|
||||
+----------+-------+---------+------+------------+------------+
|
||||
|
|
Loading…
Reference in a new issue