title: Need SQL Query Help: How to Search and Replace Specific Text LIKE x AND NOT LIKE xx
body: <p>and thanks in advance for any help. I'm working on fixing all broken links in a massive WordPress multisite database and need some help writing an SQL query to run via PHP MyAdmin. I've searched, but can't the perfect solution...</p>
  
  <p>PROBLEM: We have more than a thousand broken links that start with http:/ instead of http://</p>
  
  <p>CHALLENGE: The following would result in numerous links starting with <a href="http:///" rel="nofollow noreferrer">http:///</a></p>
  
  <pre><code>    UPDATE wp_1_posts
      SET post_content = replace (post_content, 
      'http:/', 
      'http://');
  </code></pre>
  
  <p>PROCESS: I want to write a query to SELECT all these links first, so I can review them to ensure I don't do any damage when replacing the text string. Downloading a db dump and doing a manual S&amp;R is not an option since we're talking about a multi-gigabyte database.</p>
  
  <p>I thought something like this would work...</p>
  
  <pre><code>    SELECT * FROM wp_1_posts
      WHERE post_content LIKE '%http:/%'
      AND WHERE post_content NOT LIKE '%http://%'
  </code></pre>
  
  <p>But that just throws a syntax error. Am I even close?</p>
  
  <p>QUESTION #1: How can I find all instances of "http:/" without returning all "http://" instances in the query results.</p>
  
  <p>QUESTION #2: How might I safely fix all instances of "http:/" without affecting any "http://" strings.</p>
  
  <p>FYI: I'll admit I know just enough about this to be dangerous, and I am not familiar with regular expressions. at. all. That's why I'm turning to you for help. Thanks again!</p>