Firstly, I hate to be a pain but I’d like to know how to specifically do this in the Search Regex WordPress plugin. It’s a popular plugin, but I don’t understand how the Replace pattern works for it, it suggests that it accepts regex, but ends up just using literals.
How can I use a replace pattern to insert a space after a certain set of letters. I have the search pattern sorted, just need to know how to replace with a space.
So if we supposed I had a search that looked for every instance where ‘testing’ was followed by a few letters and I wanted to put a space after each instance.
e.g.
testingstring
should be replaced with…
testing string
OK, I know my initial question is probably not very clear, but just in case this helps anyone in future, what I eventually realised is that I needed to split up my Regex search term using brackets e.g.
If I wanted to split up some words, where ‘testing’ was followed by a bunch of other letters than I would search for…
/([tT]esting)([a-zA-Z]+)/Then the replace pattern would be…
\1 \2the \1 would match the search pattern in the first set of brackets, then I have a space, and the \2 would match the search pattern in the second set of brackets. So let’s take the following string…
foo testingbar 123Under the search and replace patterns above, the string would be replaced by…
foo testing bar 123