Drupal Database Search and Replace

By

This article was published in the print magazine Drupal Watchdog, Volume 6 Issue 2, Fall 2016, on page 13, by Linux New Media. The magazine was distributed at Drupalcon Dublin, 2016-09-26.

For many reasons, a website's data can end up containing simple errors, such as misspelled words and obsolete numbers — far too many to fix individually. To resolve this, one could use the popular String Overrides module to always replace the erroneous values with correct ones on the fly. But this kludgy "solution" is brittle and fails to fix the underlying problem. For a Drupal 7 website, instead consider using Search and Replace Scanner, which can perform search-and-replace of plain text or regular expressions, changing the target values in all titles and fields. However, be careful, because mis-composing such a regex pattern or replacement string can wipe out far more data than is typically lost in ill-advised MySQL commands.

Copyright © 2016 Michael J. Ross. All rights reserved.

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <address> <area> <blockquote> <br> <cite> <code> <dd> <div> <dl> <dt> <em> <fieldset> <h1> <h2> <h3> <h4> <h5> <h6> <hr> <img> <input> <li> <map> <ol> <p> <pre> <span> <strong> <sup> <u> <ul>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
1 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.