AFAIK, for MySQL regex there is no native way of escaping. You can do this in PHP using preg_quote (http://www.php.net/manual/en/function.preg-quote.php), which will probably do the job for you, but obviously not intended for this goal.
My preferred way, if I were in your situation, was to create a whitelist of regular expressions in PHP, which can then be applied to your dangerous string:
$safeString = preg_replace('/[^\w]/','',$dangerousString);
This removes any non-primary characters from your string (for example, everything except A-Za-z0-9_).
NB I believe that other answers will not remove / invoke regular expressions of regular expressions, which I believe is your requirement.
lonesomeday
source share