I am using WordPress and the Search Regex plugin.
I need to covert several hundred Posts that contain a script which contains a unique Photo album number.
Each script needs to be changed to a shortcode which contains the same Photo album number.
Here is an example:
Search for the script:
<tt>%%wppa%%</tt> <tt>%%album=15%%</tt>
and replace it with the shortcode:
[wppa type="album" album="15"][/wppa]
What would I place in the Search field?
and
What would I place in the Replace field?
Use this regex:
and this replacement:
The
$numbers in the replacement refer to the capture groups:(). Overall, it's very simple, with[^%]+matching "not%",\s*matching whitespace, and[^%=]+matching "not%or=".The plugin uses PCRE, but I'm not sure if the regex needs any adjustments since I don't use the plugin. (It may require escaping the
/characters.)