Pattern Matching with REGEXP : REGEXP « Regular Expression « SQL / MySQL

Home
SQL / MySQL
1.Aggregate Functions
2.Backup Load
3.Command MySQL
4.Cursor
5.Data Type
6.Database
7.Date Time
8.Engine
9.Event
10.Flow Control
11.FullText Search
12.Function
13.Geometric
14.I18N
15.Insert Delete Update
16.Join
17.Key
18.Math
19.Procedure Function
20.Regular Expression
21.Select Clause
22.String
23.Table Index
24.Transaction
25.Trigger
26.User Permission
27.View
28.Where Clause
29.XML
SQL / MySQL » Regular Expression » REGEXP 
Pattern Matching with REGEXP
       

REGEXP Search Patterns               Definition of the Pattern
abc                                  The string abc.
(abc)                                The string abc (formed into a group.
[abc]                                One of the characters a, b, c.
[a-z]                                A character in the range a to z.
[^abc]                               None of these characters (but any other).
.                                    Any character.
x                                    The expression x must appear once.
x|y                                  The expression x or y must appear once.
x?                                   The expression x may appear once (or not at all.
x*                                   The expression x may appear arbitrarily often (or not at all).
x+                                   The expression x may appear arbitrarily often, but at least once.
x{n}                                 The expression x must appear exactly n times.
x{,n}                                The expression x may appear at most n times.
x{n,}                                The expression x must appear at least n times.
x{n,m}                               The expression x must appear at least n and at most mtimes.
^                                    Placeholder for the beginning of the string.
$                                    Placeholder for the end of the string.
\x                                   Special character x (e.g., \$ for $).

   
    
    
    
    
    
    
  
Related examples in the same category
1.REGEXP 'e'
2.REGEXP '^ba'
3.REGEXP and CONCAT
4.REGEXP '[abc]'
5.REGEXP 'm.n'
6.REGEXP '[men][men]'
7.POSTCODE REGEXP '[0-9][0-9]*[a-z][a-z]*'
8.NAME REGEXP '^[a-z]{7}'
9.NAME REGEXP '^[a-z]{6,7}$'
10.POSTCODE REGEXP '4{4}'
11.REGEXP '[[.space.]]'
12.REGEXP '[[:<:]]Street[[:>:]]'
13.NAME REGEXP '^n.*e$'
14.REGEXP '[a-z]{9}'
15.Regular expressions do not match NULL values. This is true both for REGEXP and for NOT REGEXP
16.SELECT c, c REGEXP '.', c REGEXP '^', c REGEXP '$' FROM mytable;
17.With REGEXP, you need a double backslash to match a metacharacter literally:
18.The primary options that you can use with the REGEXP operator to create expressions in your SQL statements.
19.Be more specific with the REGEXP operator by extending the specified value used by the operator
20.The command REGEXP offers many more possibilities for formulating a pattern,
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.