title: What is the correct syntax for a Regex find-and-replace using REGEXP_REPLACE in MariaDB?
body: <p>I need to run a regex find-and-replace against a column named <code>message</code> in a MySQL table named <code>post</code>.</p>
  
  <p>My database is running MariaDB 10. </p>
  
  <p>According to the <a href="https://mariadb.com/kb/en/mariadb/documentation/functions-and-operators/string-functions/regular-expressions-functions/regexp_replace/" rel="nofollow">docs</a>, MariaDB 10 has a new <code>REGEXP_REPLACE</code> function designed to do exactly this, but I can't seem to figure out the actual syntax. </p>
  
  <p>It will affect 280,000 rows, so ideally there's also a way to limit it to only changing one specific row at a time while I'm testing it, or simply doing a <code>SELECT</code> rather than an <code>UPDATE</code> until I'm sure it does what I want. </p>
  
  <p>The regex I want to run:
  <code>\[quote\sauthor=(.+)\slink=[^\]]+]</code></p>
  
  <p>The replacement string: 
  <code>[quote="$1"]</code></p>
  
  <p>The following was what I tried, but it just throws a SQL error:</p>
  
  <p><code>UPDATE post SET message = REGEXP_REPLACE(message, '\[quote\sauthor=(.+)\slink=[^\]]+]', '[quote="$1"]')  WHERE post_id = 12</code> </p>
  
  <p>In this case, the original message was:
  <code>[quote author=Jon_doe link=board=2;threadid=125;start=40#msg1206 date=1065088]</code> and the end result should be <code>[quote="Jon_doe"]</code></p>
  
  <p>What is the proper syntax to make this <code>REGEXP_REPLACE</code> work?</p>