Search Regex Plugin

Jun 12, 2006 | Tags: , , , | Written by Administrator

download

Download: search-regex.zip
Version: 1.4.5
Updated: January 9, 2008
Size: 51.15 KB

Support This Plugin!

While this software is being provided free to use, it takes considerable time to develop and support. If you do find it particularly useful or want to request a feature then consider donating money as an incentive for me to carry on developing it.

Thanks!

I have other plugins too!

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.5 - Add search regex capabilities ('search_regex_read' and 'search_regex_write'). Fix meta values
  • 1.4.4 - Fix escaping issue, allowing search limit and direction
  • 1.4.3 - Allow searching in trackbacks and pings
  • 1.4.2 - Fix escaping bug
  • 1.4 - Extensible plugins. Reorganisation of code

Installation

Installation is just like any WordPress plugin:

  • Download search-regex.zip
  • Unzip
  • Upload directory to /wp-content/plugins on your server
  • Activate the plugin
  • Use Search Regex from the Manage/Search Regex menu

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:

Search Regex 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.

Preview

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.

Inline Replace

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

Date Current outstanding bugs Status
12 Mar 2008 Missing results
12 Mar 2008 UTF-8 characters
06 Apr 2008 Invalid request
06 Apr 2008 Page links dont work
07 Apr 2008 Search Regex Can't Find '
18 Apr 2008 Search Regex in Wordpress 2.5

A full list of all bugs can be found in the Search Regex issue tracker.

Date Current requested features
31 Jan 2008 Change Limit behaviour or Label
02 Feb 2008 Add Ability to Search and Replace for Specific Posts/Pages
25 Feb 2008 Search sniplets
29 Mar 2008 Add checkboxes to replace search-results
06 Apr 2008 Replace with newline

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.

Share This

Comments (page 8 of 8)

  1. Joni Solis :

    Apr 28, 2008 2:02 pm

    When I click on the link in this web page (above):

    18 Apr 2008 Search Regex in Wordpress 2.5

    I get a page that says:

    502 Bad Gateway
    nginx

    ====
    I just want to know if this WordPress Plugin works well with WordPress 2.5.

  2. author
    Joel Teixeira (subscriber) :

    Apr 21, 2008 7:47 am

    neither to me.. :-(

  3. Joni Solis :

    Apr 20, 2008 5:47 pm

    I just upgraded to WordPress 2.5. and would love to know if anyone is getting this Search Regex Plugin to work with the latest WordPress? Or is there another plugin out there that does the same thing and works with WordPress 2.5. Thanks!

  4. jez :

    Apr 18, 2008 6:16 am

    not working for me in wordpress 2.5 - get barely any (if) results.

  5. author
    Joel Teixeira (subscriber) :

    Apr 12, 2008 2:52 pm

    Hi John,

    Is the Search Regex plugin working with Wordpress 2.5? I made some searchs and almost always I got no results even when I tried some words that I was seeing in some posts (on another tab of my browser). Initialy I wanted to change the size of my blog videos, I use FLV Embed and the way to post video is example: "flv:nameofthevideo.flv 320 240]". I'would like to change "320 240]" with "480 360]" just an example. No results.

    Thanks

  6. Manish :

    Mar 26, 2008 5:16 am

    Hi, I am using WP2.3.3 and installed this plugin 1.4.5 ver, but I don't see these options
    # 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)
    Also there is no save option below the search and replace boxes as shown in your example above.

    I need to add rel="nofollow" to <a hre tags in a particular category only. How can I do this.

  7. JonahCoyote :

    Feb 2, 2008 4:33 pm

    Hi there, excellent plugin and thank you very much! I'm wondering if it is possible to also include a filter for specific posts/pages, say only pages whose parent is equal to a specific id or even just specific page/post id's?

    Thanks,
    Jonah

  8. Joni Solis :

    Jan 21, 2008 8:03 pm

    I just used your wonderful Search Regex Plugin to find all the old tag codes [tag][/tag] and [tags][/tags] that where in all my post since I tossed out my old SimpleTagsPlus plugin. BUT I first installed your HeadSpace Plugin and then "imported" all my tags from SimpleTagsPlus before I disabled and and tossed the old tag plugin.

    You should add info about this Search Regex Plugin on your instructions on how to use your HeadSpace Plugin, because at first I was editing one post at a time and removing the tag codes before I found in installed Search Regex.

  9. SEO Blogger :

    Jan 21, 2008 2:07 pm

    Hi, John have figured out what's wrong... LoL.
    Silly me, I didn't switch the 'limit' from "10" to "No Limit" ;D.
    Anyway, that's why I can use the plugin on one blog and not the other xP.

    *Also, just a suggestion, maybe setting the 'default' limit to "No Limit" AND
    have a BIG BOLD RED WARNING to 'command' the user to BACK UP the database first
    before doing the db replace?

    ~The SEO Blogger~
    P.S. Thanks for a "dangerous-if-you-don't-know", "useful-if-you-know" how the db works =P.

  10. John (author) :

    Jan 16, 2008 11:16 pm

    SEO, do you have an admin login I can use to play around and see what happens? The first and second posts are not important at all, and you can delete or edit them as you see fit.

Pings & Trackbacks

alligatorcat.com, blog.nanowings.de, cooperation.gensys-net.eu, d.teknoseyir.com, dltj.org, facemakers.stu.ru, ivangelion.tw, ldl.blog.dark-souls.ru, lifehacker.biz, obezblog.com, plasticdreams.org, shakin.ru, sparanoid.com, tecnoblog.net, triumphalroman.net, ultra.boy.jp, webloger.ru, wpstation.com, ayiva.com, blogpiloten.de, ccicenter.org, clarkburbidge.com, freefullsoftwares.com, isaythat.com, lostnode.com, luxeseo.com, makadco.com, midasoracle.org, mr-foto.net, perraco.com, psicofxp.com, rehlaonline.com, seopost.ru, smashingmagazine.com, socialdailynews.com, tmthai.com, tommyholiday.ch, venukb.com, wordpresscn.com, wordpressplugin.org, zhangzhang.net, xuyiyang.com

Leave a comment


XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

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.

Home | Software | Terms & Conditions | Sitemap | John Godley © 2008
Close
E-mail It