Commit 171aa6fe authored by unknown's avatar unknown

manual.texi fix tutorial examples that become incorrect when

manual.texi	REGEXP became case insensitive.


Docs/manual.texi:
  fix tutorial examples that become incorrect when
  REGEXP became case insensitive.
parent ba1b7eaa
...@@ -24782,10 +24782,10 @@ To demonstrate how extended regular expressions work, the @code{LIKE} queries ...@@ -24782,10 +24782,10 @@ To demonstrate how extended regular expressions work, the @code{LIKE} queries
shown above are rewritten below to use @code{REGEXP}. shown above are rewritten below to use @code{REGEXP}.
To find names beginning with @samp{b}, use @samp{^} to match the beginning of 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 @example
mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]"; mysql> SELECT * FROM pet WHERE name REGEXP "^b";
+--------+--------+---------+------+------------+------------+ +--------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death | | name | owner | species | sex | birth | death |
+--------+--------+---------+------+------------+------------+ +--------+--------+---------+------+------------+------------+
...@@ -24794,6 +24794,23 @@ mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]"; ...@@ -24794,6 +24794,23 @@ mysql> SELECT * FROM pet WHERE name REGEXP "^[bB]";
+--------+--------+---------+------+------------+------------+ +--------+--------+---------+------+------------+------------+
@end example @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 To find names ending with @samp{fy}, use @samp{$} to match the end of the
name: name:
...@@ -24807,11 +24824,10 @@ mysql> SELECT * FROM pet WHERE name REGEXP "fy$"; ...@@ -24807,11 +24824,10 @@ mysql> SELECT * FROM pet WHERE name REGEXP "fy$";
+--------+--------+---------+------+------------+-------+ +--------+--------+---------+------+------------+-------+
@end example @end example
To find names containing a @samp{w}, use To find names containing a lowercase or uppercase @samp{w}, use this query:
@samp{[wW]} to match either lowercase or uppercase @samp{w}:
@example @example
mysql> SELECT * FROM pet WHERE name REGEXP "[wW]"; mysql> SELECT * FROM pet WHERE name REGEXP "w";
+----------+-------+---------+------+------------+------------+ +----------+-------+---------+------+------------+------------+
| name | owner | species | sex | birth | death | | name | owner | species | sex | birth | death |
+----------+-------+---------+------+------------+------------+ +----------+-------+---------+------+------------+------------+
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment