Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
MySQL
Regular Expression 93 codes
Home
MySQL
Regular Expression
1 % means 0 or more characters
2 {3,} means the a must occur at least three times
3 A regular expression matches anywhere in the string
4 An underscore (_) matches only one character exactly
5 As the plus sign (+) indicates that g had to appear one or more times
6 Be more specific with the REGEXP operator by extending the specified value used by the operator
7 Checking Whether a String Contains a Substring
8 Controlling Case Sensitivity in Pattern Matching By default, LIKE is not case sensitive
9 Curly braces group abc as a whole, and square brackets allow any of a, or b, or c to match, allowing a whole range of o
10 Group the alternatives within parentheses, the ^ and $ will apply to both of them
11 If you wish to encompass the entire character string, you must use ^ and $ in the search
12 LIKE %e_
13 LIKE %is%
14 LIKE _@%%@%_ ESCAPE @
15 LIKE ______ (underscore)
16 LIKE ______% (underscore and %)
17 LIKE _r%r_
18 LIKE Search Pattern
19 Like %r
20 Like and concat
21 Like and escape
22 Like B%
23 Limit the match on the i to either zero or one
24 Match only aaa
25 Matches strings that begin with a vowel or end with er
26 Matches where a is the first character
27 Matching Pattern Metacharacters Literally
28 MySQLs regular expression capabilities also support POSIX character classes
29 Name and regular expression
30 NAME REGEXP ^[a-z]{6,7}$
31 NAME REGEXP ^[a-z]{7}
32 NAME REGEXP ^n e$
33 Parentheses indicate an entire character string, and curly braces indicate how many times the character string
34 Patter match
35 Pattern in Where clause
36 Pattern match
37 Pattern Matching
38 Pattern Matching with REGEXP
39 Pattern Matching with Regular Expressions
40 POSIX classes are intended for use within character classes, so you use them within square brackets
41 POSTCODE REGEXP [0-9][0-9][a-z][a-z]
42 POSTCODE REGEXP 4{4}
43 REGEXP [[
44 REGEXP [[ space ]]
45 REGEXP [abc]
46 REGEXP [a-z]{9}
47 REGEXP [men][men]
48 REGEXP ^ba
49 REGEXP and CONCAT
50 REGEXP e
51 REGEXP m n
52 Regular expression
53 Regular expression and postcode
54 Regular expression and street value
55 Regular Expressions
56 Regular expressions do not match NULL values This is true both for REGEXP and for NOT REGEXP
57 SELECT c, c REGEXP , c REGEXP ^, c REGEXP $ FROM mytable
58 Show records where the model is a cross cut type
59 Show records where the name begins with a B
60 Show records where the name begins with a B or C
61 Show records where the name contains a W
62 Show records where the name contains a W or a N
63 Show records where the name ends with a H
64 Show records where the name has 6 characters
65 Show records where the name matches a search pattern
66 SQL patterns do not match NULL values This is true both for LIKE and NOT LIKE
67 Square brackets indicate a selection from among several characters, a hyphen is used to indicate a range of ch
68 String begins with
69 String case in regular expression
70 String contains
71 String ends with
72 String with exact length
73 Strings that begin with a particular substring
74 Strings that contain a particular substring anywhere
75 Strings that contain a particular substring at a specific position
76 Strings that contain a particular substring at any position
77 Strings that contain a substring at a specific position
78 Strings that end with a particular substring
79 The % wildcard returns any number of characters
80 The asterisk () indicates zero or more
81 The caret (^) anchors the start, and the dollar sign ($) the end
82 The command REGEXP offers many more possibilities for formulating a pattern
83 The primary options that you can use with the REGEXP operator to create expressions in your SQL statements
84 To get the equivalent with LIKE, youd have had to use % wildcards at the end
85 To make a pattern match case sensitive, use a binary string for either operand
86 To match a literal instance of a SQL pattern metacharacter, precede it with a backslash
87 To match abcabcabc, you need to use parentheses
88 To reverse the sense of a pattern match, use NOT LIKE
89 Usage of the % wildcard
90 Using Operators in Your SQL Statements
91 Using Pattern Matching
92 Where clause
93 With REGEXP, you need a double backslash to match a metacharacter literally