A regular expression describes a set of strings. A regular expressions for the REGEXP operator may use any of the following special characters and constructs:
- . match any character (including carriage return and new line)
SELECT function_name FROM `functions` WHERE function_name REGEXP 'anchor..'
- ^ match the beginning of a string
SELECT function_name FROM `functions` WHERE function_name REGEXP '^a';
- $ match the end of a string
SELECT function_name FROM `functions` WHERE function_description REGEXP 't$';
- [characters] match any characters or using range
SELECT function_name FROM `functions` WHERE function_name REGEXP '^[a-d]';
Still using function table, let’s see the other developing using regex.
To view function_name which has 4 characters:
SELECT function_name FROM `functions` WHERE function_name REGEXP '^....$';
Or we can write like this:
SELECT function_name
FROM `functions`
WHERE function_name
REGEXP '^.{4}$';
Hmm I think is enough for introduction of REGEXP
.
