If you need to search and replace some text throughout your weblog, you should definitely be using Urban Giraffe’s Search Regex. With Search Regex you can search and replace text in all the fields shown in the picture below:
Search Regex
If you are replacing some text, first enter the Search pattern and press the Search button. This will show you the results, so you can fine tune the pattern to get only the results you want. You also get a set of links to view and edit the post. Very handy.
Search Regex results
If you are satisfied with your search results, you can enter the Replace pattern. Then press Replace button. You will get all list of all the search results together with the preview of how the text will look like after the replace. Now you can manually decide if you want to replace each one of search results by clicking replace.
Search Regex replace
When replacing some text on your website always make sure to search through each of these fields (use the Source drop-down menu):
Post content
Post meta value (catches meta descriptions and keywords)
Post title
Post excerpt
Replacing the word in Post content is often not enough, if you don’t also search Post title and Post meta and Post excerpt you will miss instances.
While it’s possible to have changes made immediately (Replace All), we recommend you that you avoid Replace & Save, as this will alter your posts immediately. Use only if you are 100% sure what you are doing and you have a huge number of changes to make.
Search Regex has even more powerful replacement options, via regular expressions. If you have some programming skills and you understand Perl compatibile Regular Expressions you can check Regex checkbox and extend the functionality of this great plugin.
Regular expression on the following screenshot will search for every occurance of word ‘easy’ without blank space before it.
Search Regex regular expressions
Writing about regular expressions could be a subject to a whole new article or even set of articles. If you want to know more about regular expressions, here are some interesting links:
Martin graduated as an engineer in Computer Science from Slovak Technical University in Bratislava. He grew up in Liptovský Mikuláš in northern Slovakia next to the beautiful Tatra mountains. He is the developer behind our FV Player.
Reader Interactions
Comments
ngadimin
Hi martin
I’m trying to match with attributes tag using this pattern:
@(.*?)@
but always return nothing, i search the plugin developer site, but he didn’t reply the question of this kind of problem. can you help me?
that regex doesn’t make much sense, it’s searching for at least zero occurrences of a dot symbol. If you want to search for multiple dot symbols in string, you need to use this:
This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Necessary Cookies
Strictly Necessary Cookie allow you to log in and download your software or post to forums.
We use the WordPress login cookie and the session cookie.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.
Support Cookies
Foliovision.com uses self-hosted Rocket.chat and self-hosted Freescout support desk to provide support for FV Player users. These cookies allow our visitors to chat with us and/or submit support tickets.
We are delighted to recommend self-hosted Rocket.chat and especially Freescout to other privacy-conscious independent publishers who would prefer to self-host support.
Please enable Strictly Necessary Cookies first so that we can save your preferences!
3rd Party Cookies
This website uses Google Analytics and Statcounter to collect anonymous information such as the number of visitors to the site, and the most popular pages.
Keeping this cookie enabled helps us to improve our website.
We reluctantly use Google Analytics as it helps us to test FV Player against popular Google Analytics features. Feel free to turn off these cookies if they make you feel uncomfortable.
Statcounter is an independent Irish stats service which we have been using since the beginning of recorded time, sixteen years ago.
Please enable Strictly Necessary Cookies first so that we can save your preferences!
Hi martin
I’m trying to match with attributes tag using this pattern: @(.*?)@
but always return nothing, i search the plugin developer site, but he didn’t reply the question of this kind of problem. can you help me?
the sample data i want to match is
Hello ngadmin,
that regex doesn’t make much sense, it’s searching for at least zero occurrences of a dot symbol. If you want to search for multiple dot symbols in string, you need to use this:
@(.{2,})@
You need to HTML encode any special input with HTML in our comments, you can use this tool: opinionatedgeek.com/dotnet/tools/htmlencode/encode.aspx
Thanks, Martin