Support » Plugin: Search Regex » ADDITIONAL USAGE NOTES 2

  • Just to add to aeric325’s useful notes:

    1. If the Regex[ ] box is unchecked, then the “Search pattern” is a simple literal string, where you specify the text you want to match, and “Replace pattern” is the replacement string.
      1. Click the Search button to check that your Search pattern is working.
      2. Click the Replace button to PREVIEW that your Search and Replace patterns are working. It does NOT make any permanent changes.
      3. Click the Search & Save button to perform a search and replace, that will irreversibly update your posts, etc.
    2. Check the Regex[ ] box to specify “regex” style wild-card searches. For example, let’s suppose we want to modify a link URL:
      • From: <a href="http://www.mydomain.info/index.php\?title=Some_text">
      • To: <a href="/Some_text/" class="internal">
      • Where “Some_text” varies from link to link
      • Then:

      • Search pattern: @<a href="http://www.mydomain.info/index.php\?title=(.*?)">@
      • Replace pattern: <a href="/$1/" class="internal">

      Note that:

      • The Search pattern is surrounded by @ symbols which act as delimiters, and are required
      • In the search string, the following characters have special meaning: ^.[$()|*+? and must be preceded by a \ if they are to be used literally, such as where you see \?
      • In the search string, (.*?) is he the wild-card indicator.
      • In the replace pattern, the $1 represents the text found by the wildcard
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
    • This topic was modified 1 year, 1 month ago by iantresman.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘ADDITIONAL USAGE NOTES 2’ is closed to new replies.