Search Regex Plugin
Search Regex adds a powerful set of search and replace functions to WordPress. 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.
The driving force behind this plugin is to aid in website migration and upgrading. If you've ever done either of these then you know the pain of having to go back through all your data, changing URL paths and fixing things. With this plugin you can reduce this work to a search and replace pattern and the job is finished in seconds.
Why would you want this? The primary reason for the plugin was to aid in relocating directories. It's a real pain to manually go through every post and change image directory names. With this plugin all that was required was a simple search and replace pattern, and the job was finished in a few seconds.
Features include:
- Simple search and replace
- Advanced regular expression search and replaces, including back references and capture groups
- Search previews with inline replacing
- Perform searches in post & page content, excerpt, titles, URL, and meta-data, as well as comment content and author data
- Full support for WordPress roles. You can only search and replace in posts you have access to
- Fully localized
Get the Flash Player to see this movie.
Version History
- 1.4.10 - Fix deep slashes
- 1.4.9 - WP 2.8 compatibility
- 1.4.8 - Update base library. Fix issue with regex not being selected
- 1.4.7 - Fix for 2.6 versions
- 1.4.6 - Added tag & sniplet searching. Make work in Safari
Installation
Installation is just like any WordPress plugin:
- Download search-regex.zip
- Unzip
- Upload directory to
/wp-content/pluginson your server - Activate the plugin
- Use
Search Regexfrom theManage/Search Regexmenu
You can find full details of installing a plugin on the plugin installation page.
Usage
Searches can be performed from the Search Regex submenu, contained within the main Manage menu of the administration interface. Once there you will be presented with the following interface:
The search and replace patterns are, as you would expect, where you enter what you want to search for and what you want to replace it with. Several options exist to refine the searching capabilities, which will be explained later. You can also chose the data source.
When you have entered your patterns you need to press one of the search buttons:
- Search - Just do a search and show the results
- Replace - Perform a search and replace, but only show the results. The database is not changed.
- Replace & Save - As Replace, but the replacements are saved back into the database.
It should be noted that while you can enter any search pattern in a simple search, you must adhere to regular expression syntax when the regular expression mode is enabled. The plugin will detect any regular expression errors and warn you.
If you wish to remove a search pattern (i.e. search for 'cheese' and delete the any occurrences) then you can leave the replacement pattern empty.
Search Options
The following options modify the search:
- Regex - Enable regular expressions. Note that the search pattern can now only contained properly escaped characters. The @ character is used as a delimiter and also needs escaping.
- Case-less - Case insensitive search
- Multi-line - Enables multi-line mode (see PHP's pattern modifiers page)
- Dot-all - Enables the dot-all mode (see PHP's pattern modifiers page)
Results
Search results as presented as a list of found occurrences. Each result is shown in context with the surrounding data and, if enabled, the replacement context is also shown.
Depending upon the data source you have options to view, edit, or replace the data. Additionally, if you double-click on the highlighted search or replace patterns then an inline edit box will appear allowing you to directly edit the data.
Examples
The simplest case is changing paths:
/wp-images/
to
/images/
A more complicated regular expression version to only move PNG images:
/wp-images/(.*?).png
to
/images/png/$1.png
Warning
You should always use the Search & Replace preview before saving to the database. I will accept no responsibility for any damage caused to your data. If you are in any doubt then backup your database first.
Support
Please direct all support questions to the Search Regex support forum. Any support questions left on this page may not be answered.
Bugs & New Features
A full list of all bugs can be found in the Search Regex issue tracker.
A full list of all requested features can be found in the Search Regex feature tracker.
Help me to save time by reading these instructions!
Please report bugs in the Search Regex issue tracker.
Please make feature suggestions in the Search Regex feature tracker.
Please direct all support questions to the Search Regex support forum.







Comments (page 3 of 3)
Mar 29, 2009 11:47 am |
What I cannot understand - is why now working examples?
Regex isn't actually "a walk in the park"...
Thanks anyway.
Apr 30, 2009 12:07 pm |
This may be what I'm looking for (haven't tried it yet) but I build many WordPress pages for clients. I usually start locally on my box using a localhost, then transfer all the data to an online host. This causes headaches primarily with the images uploaded via the WordPress media uploader.
Looks like an awesome tool to combat that problem quickly! Cheers!
Jun 1, 2009 2:38 pm |
What does it mean when, after clicking on "Replace>>", each return says above it, view | '); return false">replace | edit ??
I'm on WP 2.7.1
Thanks.
Jun 16, 2009 8:10 am |
your notes say, "Perform searches in post & page content, excerpt, titles, URL, and meta-data, as well as comment content and author data."
how do i do a search and replace on a "page," not just a post?
thanks!
deb
Jun 16, 2009 1:31 pm |
Nothing special is needed: post=page
Jun 20, 2009 2:21 am |
Hi. After reading the doc and the comments on this plugin I've just downloaded it as I'm getting ready to migrate my dev site to a production host. This plugin should save a LOT of time.
Being a bit rusty on Regex (its been a while since I've done full bore UNIX) I did a Google search and came across a ref that others might find handy: http://www.funduc.com/regexp.htm.
If you're new to regex, study it carefully and it will make sense. There are examples given.
Hope this helps.
Jun 26, 2009 2:00 pm |
seems that after the update to 2.8 of wordpress, the replace as well as replace and save functions no longer work properly. Any ideas?
Jun 29, 2009 3:22 am |
The plugin is not 2.8 compatible yet
Jan 23, 2010 11:25 am |
Note: it is now
Aug 16, 2009 11:55 am |
is it possible to search post meta key for posts?
Aug 29, 2009 10:28 am |
Thanks for this plug-in!
Can this search admin pages? I want to replace simple text such as the word "post" to the word "tribute".
Thanks.
Sep 9, 2009 2:52 pm |
What do you mean by admin pages?
Oct 2, 2009 9:32 am |
I'm anxious to try this one out, as I just moved a bunch of files around on my site.
Dec 11, 2009 4:11 pm |
This plugin totally rocks. We used to replace some youtube plugins machine tags. It was so quick and painless, but we still backed up the database.
Jan 18, 2010 5:38 am |
nice plugin
arabic lang file v.1.4.9 :
http://www.r-sn.com/wp/wp-content/plugins/download-monitor/download.php?id=search-regex-1.4.9-ar.zip
thanks
Jan 23, 2010 11:25 am |
Added to the plugin, thanks!
Jan 25, 2010 8:30 pm |
Sir, thank you. Nice little interface. Saved me hours.
jm
Pings & Trackbacks
wpstation.com, wordpresscn.com, plasticdreams.org, dltj.org, wordpresscn.com, smashingmagazine.com, tecnoblog.net, blogpiloten.de, xuyiyang.com, sparanoid.com, clarkburbidge.com, mr-foto.net, perraco.com, shakin.ru, psicofxp.com, rehlaonline.com, zhangzhang.net, rehlaonline.com, facemakers.stu.ru, triumphalroman.net, midasoracle.org, venukb.com, rehlaonline.com, newsoft.com.ua, alabase2.com, themelab.com, 1wordpress.com, readers-edition.de, desperatelyseekingwp.com, devilsworkshop.org, parandroid.com, onecho.com, onecho.com, goodyao.cn, volkandesign.com, onu7.com, pi-kun.com, wp-plugin-archive.de, 1stwebdesigner.com, neurosoftware.ro, davepit.com, zdaylan.com, sjwets.nl, acunetix.com, michelfortin.com, nicksimnews.com, csscody.com, allpctips.net, bizsoftlab.com, freewordpressthemes.us, qwertyweb.ru, seozebra.ru, wordpress.blogos.dk, dalog.tokyolife.org, fosfo.ru, wptime.com, sisadmin.net.ru, barneyb.com, wp-dir.com, hqwordpress.com, 60m.org, davidchinphoto.com, wp.sk, com5.info, blog.neptis.info, vocidalweb.it, ebooktm.com, akgun.6te.net,
Leave a Reply