Author Topic: Regex backreference in MultiRename?  (Read 11880 times)

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 514
    • View Profile
Regex backreference in MultiRename?
« on: July 23, 2020, 16:59:14 »
I'm wondering if I should be able to use a backreference in MR?

eg to change S27 to Session 27
Code: [Select]
(S\d+)|" - Session "\1
I've tried \1 in a variety of places vs the "" & it won't call it, only giving bad chars warning in the rename preview pane.  :-\

The ECMA REGEX script syntax linked to elsewhere says

\int   |backreference   |the result of the submatch whose opening parenthesis is the int-th (int shall begin by a digit other than 0).
(subpattern)   |Group   |Creates a backreference.
(?:subpattern)   |Passive group   |Does not create a backreference.



Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4416
    • View Profile
    • Multi Commander
Re: Regex backreference in MultiRename?
« Reply #1 on: July 23, 2020, 19:32:55 »
It does not currently support regex replace.
The "search and replace" part in MultiRename is using regex for "Find" part. So you find a match using regex. Then in the "replace with" part enter the thing you want to replace with

With MultiScript you have StrRegExpReplace that support RegEx find and replace. but then you need to use script.

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 514
    • View Profile
Re: Regex backreference in MultiRename?
« Reply #2 on: July 24, 2020, 13:06:53 »
Thanks Mathias.

I'll see what I can do with scripting  :D

OT
In the new Find Pane (RES #) are you planning to make scripted buttons accessible for the found items?
I was thinking that it would be nice to be able to rename items via script from the RES pane, eg Name as Folder for items found in sub-folders etc.