Search Regex
Search Regex

Search Regex

John Godley

Search Regex adds a powerful set of search and replace functions to WordPress posts, pages, custom post types, and other data sources. These go beyond the standard searching capabilities, and allow you to search and replace almost any data stored on your site. In addition to simple searches you have the full power of PHP’s regular expressions at your disposal.

You can use this to do things like:
– Help migrate a site from one domain to another
– Update URLs in links and images
– Perform site-wide changes

Search filters can be created to match any column of any WordPress table. For example:
– Find all posts in a category
– Find all post meta data without a post
– Find all posts in a date range

Search Regex handles small and large sites.

Search Regex has been tested with PHP from 7.0 to 8.3.

What can I search?

You can search:
– Posts
– Pages
– Any custom post type
– Comments (including spam)
– Users
– Meta data
– WordPress options
– Supported plugins (such as Redirection)

Full regular expression support is provided, and you can capture data and use it in the replacement.

Actions

A variety of actions can be performed on matching results:
– Modify and replace the result
– Delete the result
– Export to CSV and SQL
– Perform custom PHP action

Modify and Replace Data

Results can be individually modified by clicking on the item to change, and using the popup modifier.

Bulk modifications can be performed against all matching results.

The types of modification depend on the data being changed:
– Numbers can be added or subtracted to existing numbers
– Hours, days, weeks, and months, can be added to dates
– Tags and categories can be added, removed, and substitued

Custom shortcodes are supported that allow dynamic data to be included:
– Add the current date and time, in any format, to content
– Insert data from other columns. For example, insert the category into the title
– Transform existing data. For example, convert case, change underscores to dashes.

Example uses

Some ideas for potential uses:
– Delete all comments that match a phrase
– Add a category to all matching posts
– Remove orphaned meta data

Support

Please submit bugs, patches, and feature requests to:

https://github.com/johngodley/search-regex

Please submit translations to:

https://translate.wordpress.org/projects/wp-plugins/search-regex

Translations

Translations are provided by WordPress itself. You can update the translations by going to the Dashboard > Updates section of WP admin.

Documentation

Full documentation can be found on the Search Regex site.

Only efficient Search&Replace I found

By franckmee on September 1, 2024

An absolute must-have for people migrating huge data and having to correct loads of broken links. Does for free, with a quite powerful interface, what others promise to provide if you pay first.

REGEX?

By brian7997 on August 20, 2024

For a plugin called SEARCH REGEX, maybe have REGEX enabled by default? For a title feature to be hidden in dropdown is a bit annoying. If someone is installing this, they clearly looked for REGEX eh?
I'd suggest keeping REGEX enable/disable a separate setting that is always visible.

Best search & replace plugin

By carlosmtnez on May 12, 2024

I've tried lots of plugins like this, and this is the better by far. Thank you!

BEWARE - EXTREMELY DANGEROUS !!!

By argaliano15 on December 11, 2023

This is one of the worst plugins I have ever seen. It loves to silently delete your posts. All you have to do is touch that "Delete" link that spends most of its time invisible, hiding 10 pixels from the "View" link, and POOF! your post is gone. Forever. Not in the trash, not made private or draft, no, it is gone right out of the database table like it never existed. There is no warning, no confirmation, nothing. In fact, it happens so fast you will probably miss it. Much later, you will wonder what happened to all your posts - now you know.

I finally had to hack the javascript and disable the delete function to make the plugin safe enough to use at all. But even after that, I found it had gotten me a second time, and I'm afraid I just don't know how many more posts this plugin has eaten. There is no record, they are just gone. I finally disabled most of the user interface, as no part of it is safe - you can end up doing a lot of damage without even realizing it. Most of that is irrelevant junk anyway - why should a search-and-replace have built-in edit and delete functions anyway?

This plugin actually does most of what it advertises, and pretty well, but if you are going to use it, be extremely careful. The user interface is generally clunky, vague and unhelpful, and you are left wondering what any operation might do. At one point, it deleted my entire database instead of replacing a string as it seemed to advertise. No warning or confirmation, just deleted everything. Luckily, by then I was extremely suspicious and made a fresh backup first. Sometimes match means a few characters, sometimes it means the entire post, and sometimes it means the entire database. You get to find out the fun way. This plugin is a complete boobytrap.

Hands Down best search plugin

By Ross (CodeYoda1) on November 15, 2023

This is by far the best plugin I've used for DB search. Way better than other PRO versions even.

An incredible plugin

By poi3 on July 22, 2023

I've been looking for this plugin for the past 10 years, gosh. What an incredible "little" plugin: search, bam, the pages where a given word/file is located at. That's it, super fast.

Very good plugin!!!

By salvador123 on April 23, 2023

I liked it a lot.

Saved us hours

By vgstudios on April 16, 2023

Saved us hours where another plugin would give up.

Of curse it's risky to use it [especially if you use it wrong], so always make a DB backup first, just as it says!

Thank you very much.

Flat out does not work

By anphira on March 23, 2023

I installed this plugin to do regex replacements. However, it can barely find ANYTHING even on basic searches. For example I used the search phrase:

rel="noopener" target="_blank"

That returned 96 results on the plugin search.

When I went to my posts, it returned 5,559 results.

When I ran that search on the Better Search Replace plugin, I got 279 results. Now sadly the Better Search Replace plugin flat out lies when it says it has regex. It absolutely does not.

There are TONS of and TONS of posts this plugin is missing which it should be matching. Completely unreliable. I even did direct database checks and deactivated all caching & security plugins. This plugin just can't do anything.

The best DB replace plugin with the worst name

By masvil on December 11, 2022

There are several DB replacement plugins. Search Regex is embarrassingly better than all the others, albeit more popular ones. The problem is the name. Many users are kept away from the word "Regex". It is true that it is a unique feature, but this advantage should be spent without making it seem suitable for too specific use. It should be more clear that Regex is just an option, and not even the default. However, the description is very clear. Unfortunately it's not enough, especially considering the repository's search algorithm and the way users scan results.

3.1.0 – August 8th 2024

  • Update for latest WP
  • Fix export of regular expression result
  • Switch to WP core translations
  • See changelog.txt for more details

The plugin is simple to install:

  1. Download search-regex.zip
  2. Unzip
  3. Upload search-regex directory to your /wp-content/plugins directory
  4. Go to the plugin management page and enable the plugin
  5. Configure the options from the Tools/Search Regex page

You can find full details of installing a plugin on the plugin installation page.

Reviews

4.8 out of 5 stars

  • Version: 3.1.0
  • Last updated: 2 months ago
  • Active installations: 200K
  • WordPress version: 6.4
  • Tested up to: 6.6.2
  • PHP version: 7.0