Combining regular expression characters 

You can mix the characters to get even more complicated search patterns, as shown in the following query: 

USE lahmansbaseballdb;
SELECT DISTINCT birthcity
FROM people
WHERE birthcity REGEXP '^[abc].{3}on$'
ORDER BY birthcity;

The preceding query will return any birthcity that starts with a, b, or c, then has three characters in the middle, then ends with on, as shown in the following screenshot: 

Regular expressions can be powerful, but you need to be careful when using them because they may not use the indexes of the table you are querying, and then your query can become quite slow, depending on the size of the table. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.130.201