title: Mysql search and replace
body: <p>I have a Wordpress blog, with a mysql database. I recently had to change a plugin meant for formatting code, and as a result, I'm faced with the prospect of replacing a substring in multiple rows, in a particular field, by another substring.</p>
  
  <p>The search text is: <code>&lt;pre class="lang:default decode:true "&gt;</code></p>
  
  <p>The text which replaces it is: <code>[code]</code></p>
  
  <p>The column (field) which contains the substring is: <code>post_content</code></p>
  
  <p>What I currently do is to use phpmyadmin, to find the text, export all rows to an sql dump, execute sed on the dump file, and reimport it. The substring is part of a larger string (by definition), other elements of the string should not be disturbed.</p>
  
  <p>I'd like to learn how to do this using mysql without needing to work on the dump. </p>
  
  <p>After trying out mzedeler's solution, I found that some expressions contain 
  <code>&lt;pre class="lang:default decode:true"&gt;</code> instead of <code>&lt;pre class="lang:default decode:true "&gt;</code> (one with an extra space after true). How can I do a regular expression search, and then replace with the intended string?</p>