Method: Find Replace

Find and replace components of a file's path and filename using regular expressions.

  • ToolBar
  • The toolbar allows the Find Replace list to be edited in various ways.

    • Add
    • Adds a new entry to the list. Only entries that have a checkmark beside them and don't have an empty Find value are used during processing, otherwise they are ignored.

    • Remove
    • Removes the selected entry from the list.

    • Clear
    • Removes all entries from the list. A confirmation dialog is displayed if there are more than two entries to be removed.

    • Verify
    • Goes through each entry (that is checkmarked) and ensures they are valid.

      The following checks are performed:

      1. Entry is checkmarked.
      2. If an entry doesn't have a checkmark (that is, it isn't enabled), then verification for that entry is skipped. Otherwise, the following steps are performed.

      3. Find is empty but Insert into Filename references a captured value.
      4. Captured values are taken from whatever Find captures, so referencing a captured value while Find is empty isn't possible.

      5. Find is empty but Insert into Path references a captured value.
      6. The same as 1, but instead Insert into Path is referencing a non-existent captured value.

      7. Find, Insert into Path, and Insert into Filename are all empty.
      8. All fields for the entry are empty.

      9. Find does not have a valid regular expression.
      10. The regular expression specified as the Find value is checked to ensure it is valid.

      If all of the above checks are passed, the entry is considered valid.

    • Load
    • Loads a list of Find Replace entries that have been previously saved with Save.

    • Save
    • Saves all of the entries within the list out to a file.

  • Find
  • The Find regular expression is used on the full Path & Filename of the item that is being processed and via the use of capture groups, can be inserted into the Insert into Path and Insert into Filename textboxes via the |n syntax.

    Anything entered within a pair of brackets - ( and ) - will be captured. To use the captured value(s), use a pipe | character followed by a number; the number references the index of the captured value. For example, if two parts of a string were captured, you would use |1 to access the first captured value, and |2 to access the second.

    Specifying |0 will always return the entire captured string.

    If Find was unable to successfully make a match, the item isn't processed.

    Notice about Backreferencing

    Because paths can be entered directly within both Insert into Path and Insert into Filename, the Find Replace plugin does not use the standard regular expression backreference \ character. Instead, back-references are referenced(!) using the pipe | character.


  • Insert into Path
  • This is the item's path that should be used within the root destination. For example, entering a value of My Folder would result in a folder called My Folder being created within the root destination and the currently-processing item being placed within it.

    Nesting folders is supported.

  • Insert into Filename
  • This is the new name to use for the file; the remarks for Insert into Path apply here except that you can't enter folder names here (the \ character is disallowed).

    Leaving this textbox blank will keep the name of the file as-is.

  • Test
  • The data test to use; this takes the place of the item(s) to be processed in the editor and is recommended that you use the full path and filename of an item from one of the Source Item locations. This will let you see if the Find Replace entry is working as expected.

    This Test value is ignored while FileSieve is processing.

  • Result
  • The result of the currently selected entry and the entered Test path/file data above.

    An error message will be shown if there were any errors encountered (eg. regex syntax error).

Examples

Below are some examples.

Find Insert Path Insert Filename Test Result
tv\.show\.S(\d\d)E(\d\d)\.(.*) - TV Show - |1x|2|3 tv.show.S13E01.mp4 TV Show - 13x01.mp4