MySQL Version: 8.0
I have a field that has markup-style comments, where double-asterisks in front of and behind text signify that the text between should be bold. What is the proper way to replace all instances of subsequent double-quotes with a different string? If I have a field that looks like this:
The word **bold** should be **bold** in each instance
I need the output to look like this
The word <strong>bold</strong> should be <strong>bold</strong> in each instance
I have tried to use REGEXP_REPLACE, but my regex knowledge is lacking
SET @markup = 'The word **bold** should be **bold** in each instance';
SELECT
REGEXP_REPLACE( @markup, '\*{2}(.*?)\*{2}','<strong>\$1</strong>') AS Markup;
Which results in the error:
Error Code: 3688. Syntax error in regular expression on line 1, character 1.
Fiddle: https://www.db-fiddle.com/f/7hthXC2n8nYNZoBrRKqR9q/5
REGEXP_REPLACE( @markup, '\\*{2}(.*?)\\*{2}','<strong>$1</strong>') AS Markup;