MySQL regexp Operator

 The  Regexp expression returns all the records that match a pattern. The basic syntax is

Select <column_names> from <table-names> where <column-name> REGEXP <pattern>

Regexp with ^ in MySQL

To fetch records that start with the pattern

select * from film where title regexp '^Z';

Regexp with $ in MySQL

To fetch records that end with the letter k, we do -

select * from film where title regexp 'k$';

Regexp with {} in MySQL

To fetch records with a particular length, we do-

select * from film where title regexp '^.{10}$';

Regexp with the | operator in MySQL

To fetch records with an either-or i.e. | operator, we do-

select * from film where description regexp 'Awe-inspiring | Touching';

Get all records that have the characters in MySQL

To get all such records that contain the characters between the square brackets, we do- 

select * from customer where first_name regexp '[A,D,B]'
order by first_name;