Support » Plugin: Search Regex » ADDITIONAL USAGE NOTES

  • Hopefully, these notes expand on the documentation page enough to be useful:

    * “Replace” is really “Preview”, while “Replace and Save” makes changes.

    * The buttons have “>>” at the end of the label, which is usually code for “this
    item opens another dialog”. They don’t. They perform their stated actions.
    So don’t press “Replace and Save” until you’re *sure*.

    * The screenshots indicate you can edit the replace-preview text, but that
    doesn’t work. A post from 2 years ago it hasn’t worked for going back
    3 years, at least. (So it would seem that development has ceased–but it’s
    good enough, once you suss out regular expressions.)

    * That screenshot also shows View, Replace, Edit buttons on replacement text.
    But now there are only view/edit buttons, and they apply to the entire post,

    * Clicking those buttons erase the current search, so open them in a new tab.

    * The bottom row of checkboxes makes a regex search. In a standard regular
    expression, any character but [\^$.|?*+() is supposed to be a literal, but
    many non-alphanumeric characters are interpreted by the plugin as special
    characters, including > and /. To prevent the resulting syntax errors, delimit
    the search with the plugin’s @ characters at the start and end.

    * A good idiom to know is .*?, because that is a “less greedy” match that doesn’t
    automatically match everything it possibly can on a line. It’s still a *bit*
    greedy, though. When matching (href=”.*?”), the search matched:
    href=”…” target=”
    In other words, it didn’t stop at first quotation mark it found. (However, it did
    keep from matching entirely unrelated text outside the anchor tag.)

    The solution, to get precisely the match I wanted, was (href=”[\S]*”), where
    the [\S]* ensures that the matched string has no spaces.

    * After installation, the search is found at Tools > Search Regex

    Final note:
    I installed the plugin, even though it was untested on 4.73, because of the strong functionality, and for lack of any real alternatives. So far, so good. What it does *really well* is to show you what it finds, and what it will change. So all in all, I recommend it.

Viewing 1 replies (of 1 total)
  • Thanks a ton for this user guide. Without it, I would have never been able to figure out how to accomplish what I needed. But just in case somebody else has a similar problem to mine, here is what I needed to do:

    I had code written by another developer/CMS copied from the site I was working on (no access to the innards), and it included unnecessary folders and directories which I needed to delete. About 500 instances of these.

    So by using the above guide, I was able to figure out that my search string should be:
    where *.* was random numbers, anything from 1 to 753, and my replace string was


Viewing 1 replies (of 1 total)
  • The topic ‘ADDITIONAL USAGE NOTES’ is closed to new replies.