Entity Search & Replace finds a string in the text fields of your entities, counts where it appears, and replaces it. It comes as two modules:
- Search and Replace (
snr) rewrites the field tables directly with SQLREPLACE(), in the current and revision tables. It creates no revisions and cannot be undone. - Safe Search and Replace (
snr_safe) loads each matching entity and saves it as a new revision with a log message. Earlier revisions keep the old text, entity hooks run as usual, and entities the user may not update are skipped.
Use cases
- Changing absolute URLs to relative URLs
- Updating file paths after moving a directory
- Pointing links at an old domain to a new one
- Finding how often and where a problem string appears (for example, pasted Microsoft Word styling)
- Changing strings to fit a consistent pattern
How it works
- The form lists the text columns of every stored field: titles, bodies, summaries, link URIs, email addresses, image alt text. IDs, formats, numbers, serialized columns and password hashes are not offered.
- Filter the list by entity type, bundle, field, column or type.
- Search counts the matching rows or entities and changes nothing. Matching is case-sensitive and literal.
- Replace lists the targets, shows a backup warning, and runs as a batch only after you confirm.
Stability and safety
Search and Replace writes directly to the database. Back up the database before every replace and run Search first. Use Safe Search and Replace for content that editors maintain, so every change can be reverted from the revision history.
Releases up to 1.0.1 inserted the search text into SQL without escaping, so quotes and semicolons broke the query, and Safe Search and Replace could not be installed on Drupal 10 or 11. Update to the latest release and run drush updb. Both forms now need their own restricted permission, which the update grants to roles that had Administer site configuration.
Automated tests cover both modules on Drupal 10.5 and 11.4, and the update from 1.0.1 was tested on Drupal 9.5 and 10.5.
Requirements
- Drupal 10.3 or later, or Drupal 11.
- Entity types stored in SQL tables (core's default storage). Safe Search and Replace works on revisionable entity types.
Documentation
Installation, permissions, usage and troubleshooting: project.pages.drupalcode.org/snr.
How this module is built
Changes to this module since 2026 were drafted with an AI coding assistant (Claude Code). The maintainers review, test and take responsibility for every change, and the tests and code checks run on drupal.org's CI. Contributions follow Drupal's policy on the use of AI when contributing.
Supporting this module
Developed and maintained by Tyler Brown Cifu Shuster and Jason P. Salter of FivePaths, LLC. Development sponsored by FivePaths.
Project information
- Project categories: Content editing experience, Developer tools
55 sites report using this module
- Created by tbcs on , updated
Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.






