MySQL Tutorial/Regular Expressions/Bracket

Материал из SQL эксперт
Перейти к: навигация, поиск

[.characters.]

Within a bracket expression, matches the sequence of characters of that collating element.

characters is either a single character or a character name like newline.

The following table lists the allowable character names.

Name Character NUL 0 STX 002 EOT 004 ACK 006 alert 007 backspace "\b" tab "\t" newline "\n" vertical-tab "\v" form-feed "\f" carriage-return "\r" SI 017 DC1 021 DC3 023 NAK 025 ETB 027 EM 031 ESC 033 FS 034 GS 035 RS 036 US 037 exclamation-mark "!" number-sign "#" percent-sign "%" apostrophe "\"" right-parenthesis ")" plus-sign "+" hyphen "-" period "." slash "/" zero "0" two "2" four "4" six "6" eight "8" colon ":" less-than-sign "<" greater-than-sign ">" commercial-at "@" backslash "\\" right-square-bracket "]" circumflex-accent "^" low-line "_" left-brace "{" vertical-line "|" right-curly-bracket "}" DEL 177 SOH 001 ETX 003 ENQ 005 BEL 007 BS 010 HT 011 LF 012 VT 013 FF 014 CR 015 SO 016 DLE 020 DC2 022 DC4 024 SYN 026 CAN 030 SUB 032 IS4 034 IS3 035 IS2 036 IS1 037 space " " quotation-mark """ dollar-sign "$" ampersand "&" left-parenthesis "(" asterisk "*" comma "," hyphen-minus "-" full-stop "." solidus "/" one "1" three "3" five "5" seven "7" nine "9" semicolon ";" equals-sign "=" question-mark "?" left-square-bracket "[" reverse-solidus "\\" circumflex "^" underscore "_" grave-accent "`" left-curly-bracket "{" right-brace "}" tilde "~"

Quote from MySQL Tutorial from http://www.mysql.ru

SELECT "~" REGEXP ".~.";

mysql>
mysql>
mysql> SELECT "~" REGEXP "[[.~.]]";
+----------------------+
| "~" REGEXP "[[.~.]]" |
+----------------------+
|                    1 |
+----------------------+
1 row in set (0.00 sec)


SELECT "~" REGEXP ".tilde."

mysql>
mysql> SELECT "~" REGEXP "[[.tilde.]]";
+--------------------------+
| "~" REGEXP "[[.tilde.]]" |
+--------------------------+
|                        1 |
+--------------------------+
1 row in set (0.00 sec)
mysql>