Search Regex is an amazing free WordPress plugin that enables you to search and replace code throughout your WordPress site. It can save an insane amount of time if used properly. The use cases for it are countless. To give you an idea of how useful it can be and inspire you to think about how you can leverage the tool, I’ve provided some specific examples of how I’ve used it below.
Select entire shortcode
The above search pattern will return all instances of shortcodes on your site. This could be useful if for example, you wanted to remove legacy shortcodes throughout your site.
Add a shortcode surrounding all images
The above example would add the Elegant Themes social share media shortcode for the Monarch social media sharing WordPress plugin to all images on your site. Just imagine how much time it would take to do that manually for 353 images!
Remove all links to a particular domain
The above example would select all links pointing to domain.com and remove the links while keeping the anchor text, effectively removing all links on your site pointing to domain.com.
Convert shortcode buttons to HTML buttons
[<a href="$3" class="button color-3 large">$1</a>
The above example would convert all visual composer buttons from shortcodes to HTML buttons. It simply moves the link URL and the anchor text to the correct position in the new link tag and adds the classes used for the HTML button.
Other uses for Search Regex?
If you need help figuring out how to use it effectively on your site, let me know what you want to do in the comments and I’ll see if I can help you do just that. If you have other ways to use this amazing plugin I’d love to hear about them!
Search Regex! It sounded very difficult at first But you explained it very nicely and made it easy.
You made it quite easy to understand. Thanks for writing about Regex. It save my time alot.
Thanks for introducing with the Search Regex, Currently using the Google Search Bar in most of my blog, but going to try this.
Visual Composer is a massive headache, 3000 post site previously using it leaves alot of crap to clean up. Would be great to find a a post to ragex all visual composer short codes to foundation equivalent shortcodes.
Seriously! Yes that would be a very helpful tool, but also a ton of work to not only develop initially but also to maintain.
Ah, very useful indeed. I also found this user guide on the WordPress forum. Maybe this can help other users who used this plugin too!