Download MySQL Utilities - Oracle Documentation
Transcript
REGEXP Pattern Matching (POSIX)
Match either the regular expressions from the left or right of |.
• []
Indicates a set of characters to match.
Note
Special characters lose their special meaning inside sets. In particular, the caret
symbol (^) acquires a different meaning if it is the first character of the set,
matching the complementary set (i.e., all the characters that are not in the set will
be matched).
• {m}
Match m repetitions of the preceding regular expression.
• {m,n}
Match from m to n repetitions of the preceding regular expression.
• ()
Define a matching group, and matches the regular expression inside the parentheses.
For example:
• "a\*"
Match a sequence of zero or more a.
• "a+"
Match a sequence of one or more a.
• "a?"
Match zero or one a.
• "ab|cd"
Match ab or cd.
• "[axy]"
Match a, x or y.
• "[a-f]"
Match any character in the range a to f (that is, a, b, c, d, e, or f).
• "[^axy]"
Match any character except a, x or y.
• "a{5}"
Match exactly five copies of a.
73