Match zero or more instances of the sequence abc: (abc)* : Sequence « Regular Expressions « MySQL Tutorial






mysql>
mysql> SELECT 'ABC' REGEXP '^(ABC)*$';
+-------------------------+
| 'ABC' REGEXP '^(ABC)*$' |
+-------------------------+
|                       1 |
+-------------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT 'ABC' REGEXP '^(AB)*$';
+------------------------+
| 'ABC' REGEXP '^(AB)*$' |
+------------------------+
|                      0 |
+------------------------+
1 row in set (0.00 sec)

mysql>
mysql> SELECT 'ABCABC' REGEXP '^(AB)*$';
+---------------------------+
| 'ABCABC' REGEXP '^(AB)*$' |
+---------------------------+
|                         0 |
+---------------------------+
1 row in set (0.00 sec)

mysql>








24.11.Sequence
24.11.1.Match either of the sequences de or abc: de|abc
24.11.2.Get first name with either 'av' or 'am'
24.11.3.Match zero or more instances of the sequence abc: (abc)*
24.11.4.Get first name with zero for more instances of the sequence 'Ja'