extract substring with regular expression?

Advanced Renamer forum
#1 : 09/09-21 18:11
Jim Witherspoon
Jim Witherspoon
Posts: 14
In the user guide explanation for the SUBSTR tag, I see this:

The parameters don't have to be numeric indexes, they can also be text strings to search for in the filename.
Example of use: <Substr:ki:an> will return "ng m" for "The walking man.txt".

Is there a way to get the Substr tag to extract a regular expression match in the filename?

I am figuring out how to do this using a Script but it would be nice to be able to extract a substring using regex and place it at a specific location using the Add method and the Substr tag.


09/09-21 18:11
#2 : 10/09-21 22:13
Jim Witherspoon
Jim Witherspoon
Posts: 14
It's kind of a strange way to go about it but I did find a way to do it without a script.

First, you use the Add method to add the <name> whereever you want the desired substring to appear.

Then you use a Remove method to remove everything in the added <name> that comes before the substring. Set the Starting At value at the start of the <name> you just added. Set the Remove Count value to a regex matching the start of the substring you want to extract.

Now use another Remove method to remove the part of the <name> you added that comes after the substring you want to extract. Set the Starting At value using a regex that matches what comes after the desired substring. Then set the Remove Count value using a regex that matches what comes after the <name> that you added. You may be able to use "<name>" for the Remove Count value to remove everything that came before the original name.

Any other suggestions are welcome !!


10/09-21 22:13
#3 : 10/09-21 22:18
David Lee
David Lee
Posts: 777
Reply to #2:
Simply use a Replace method with a regular expression:
https://www.advancedrenamer.com/user_guide/regul ar_expresions


10/09-21 22:18
#4 : 11/09-21 00:02
Jim Witherspoon
Jim Witherspoon
Posts: 14
Reply to #3:
Thanks - I see now.


11/09-21 00:02