Page 1 of 1

Recursive on Rename Job not working

Posted: Fri Feb 25, 2022 3:59 pm
by nna
Hi all

I'm currently testing the following flow:
Bildschirmfoto 2022-02-25 um 15.52.05.png
Bildschirmfoto 2022-02-25 um 15.52.05.png (98.93 KiB) Viewed 2430 times
Regex for Action 4: [\.']
Regex for Action 5: [^a-zA-Z0-9]|__+

What I'm trying to do: Replace the umlauts with their ASCII-friendly counterparts, replace dots and apostrophes with nothing and then replace everything that's not a letter or a digit with an underscore. Following this procedure, there are sometimes multiple underscores in a row which I want to reduce with the second part of the regex in Action 5. But for some reason, recursive doesn't work for that last action, Switch only replaces the first match. When I set 'Repeat' to 'Consecutive', it works but the multiple underscores stay. I know I could add another Rename Job element after this but that's not really as elegant ;-). Any ideas what I'm missing?

Re: Recursive on Rename Job not working

Posted: Mon Feb 28, 2022 9:24 am
by freddyp
Try with the Action - Reduce character set to get rid of all the special characters and then an action to replace multiple underscores. The regex for that is just _+ and replace it by a single underscore.

Re: Recursive on Rename Job not working

Posted: Mon Feb 28, 2022 1:53 pm
by nna
freddyp wrote: Mon Feb 28, 2022 9:24 am Try with the Action - Reduce character set to get rid of all the special characters and then an action to replace multiple underscores. The regex for that is just _+ and replace it by a single underscore.
Reduce character set doesn't work for my case unfortunately. I use this method to "normalize" metadata from an ERP to then create folders with that information. These folder names should not contain anything but letters and numbers. Reduce character set doesn't get rid of characters like spaces, dashes or ampersands. I think my method is correct but "recursive" isn't performing as expected...

Re: Recursive on Rename Job not working

Posted: Tue Mar 01, 2022 5:06 pm
by freddyp
The regex for action 5 says to match anything that is not alphanumeric or that is two underscores one or more times. But underscores are also not alphanumeric and replace one or more by one is also correct. I would say the regex simply has to be [^a-zA-Z0-9]+ which means replace one or more non-alphanumeric characters by an underscore, recursively.

Re: Recursive on Rename Job not working

Posted: Tue Mar 01, 2022 5:14 pm
by nna
freddyp wrote: Tue Mar 01, 2022 5:06 pm The regex for action 5 says to match anything that is not alphanumeric or that is two underscores one or more times. But underscores are also not alphanumeric and replace one or more by one is also correct. I would say the regex simply has to be [^a-zA-Z0-9]+ which means replace one or more non-alphanumeric characters by an underscore, recursively.
That's a good point regarding my regex. You're right of course. I changed it to the regex you suggested but recursive still doesn't work. But consecutive processes the files in the way I want, so that's solved. Thanks Freddy!