MySQL Regexp Administrative Helpers
- Dec 22, 2023 modified: Jul, 29 2026
MySQL Regexp Administrative Helpers
The MySQL database provides a powerful way to perform complex text-based searches through the regular expressions function REGEXP.
Many websites are operating a MySQL database. Often we create web forms to capture contact information.
Hence some very powerful features are available to help organise that data when we combine Regexp with MySQL.
MySQL Regexp Examples
Task: Find all Customers with Phone Numbers that contain a + or - character in the Home_Ph field.
WHERE Home_Ph REGEXP '[+-]'
If we only wanted to find the numbers with a + symbol-:
WHERE Home_Ph REGEXP '[+]'
Task: If we wanted to find the emails that contain hotmail-:
WHERE Email REGEXP 'hotmail'
Task: If we wanted to find malformed emails-:
WHERE Email NOT REGEXP '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,}$'
Task: If we wanted to find the post codes that contain 4 digits-:
WHERE Post_Code REGEXP '^[[:digit:]]{4}$';
OR
WHERE Post_Code REGEXP '^[0-9]{4}$';
Source: How to Use MySQL Regular Expressions
Task: Remove HTML tags from text efficiently
In our custom systems we may add a site search to a site that has a large number of news articles. There is no point adding a site search if there are only a few articles. Manually going through every table and removing the HTML tags is tedius. This can be done programatically in Java for every updated article. But how do we efficiently remove tags from articles that are not updated? It can be done with the following in MySQL 8-:

You could leave the tags in and wait until every article is updated. However the efficiency of the query would be affected by the letters in the tags.
Using the Powerful Features of your Database
MySQL is very good at handling many clients connecting and disconnecting to the database at a high frequency, up to 80 thousand connect and disconnects per second according to https://dev.mysql.com/blog-archive/mysql-connection-handling-and-scaling/.
That means your website database is incredibly evolved and efficient.
We wanted to build a system that better utilised the powerful features of our back-end systems. Why not make the website that collects the data also a powerful CRM tool?
We have the ability to monitor customer behaviour. Nothing sinister or breaches of privacy, just being able to detect which opt in customers are more interested in certain products or services.
Email Marketing from the same system, opens up even more power. Any system that requires duplication of data can be wasteful and inefficient.
Search News Articles...
Recent Articles

Where Is Your Business Data Really Stored?
- Aug 14 2026
- /
- 77

From Search to Answer Engines: The Rise of GEO
- Jul 21 2026
- /
- 204

Does Instagram Boost SEO?
- Jun 02 2026
- /
- 431

The Growing Gap Between Coding and Engineering
- May 16 2026
- /
- 492

Have AI Agents Destroyed Social Media?
- May 05 2026
- /
- 548

Your IP Address and SEO
- Mar 06 2026
- /
- 911

Keywords no longer as visible in GSC
- Jan 12 2026
- /
- 1575

Unique Web Systems Matter in a World of Sameness
- Dec 26 2025
- /
- 1129

Most AI Websites Fail to Rank
- Nov 18 2025
- /
- 1544

Sitemap.xml Best Practices
- Oct 14 2025
- /
- 4578
View All News Articles
Categories
A Gold Coast SEO and Web Developer