Escape special characters for SQL REGEXP
Developers will be familiar with using PHP's mysql_real_escape_string to escape problematic characters before submitting a query. When the query in question involves MySQL's REGEXP function, however, we need to go one step further and escape regex's special characters.