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>
To fetch records that start with the pattern
select * from film where title regexp '^Z';
To fetch records that end with the letter k, we do -
select * from film where title regexp 'k$';
To fetch records with a particular length, we do-
select * from film where title regexp '^.{10}$';
To fetch records with an either-or i.e. | operator, we do-
select * from film where description regexp 'Awe-inspiring | Touching';
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;