3 ms·
You can already do this with F2 by using capture variables: f2 -f '(\d+).pdf' -r '{$1}_renamed.pdf' Does that align with what you're looking for?
by ayoisaiah 1y ago
You can already do this with F2 by using capture variables:
f2 -f '(\d+).pdf' -r '{$1}_renamed.pdf'
Does that align with what you're looking for?
- sandreas 1y agoThank you, unfortunately, that's not the point :-) I knew I could do this with a regex. The advantage of using a sample instead of a regex is, that you don't need to think about it. I have "this.pdf" and I want "that.pdf" is way easier than developing a regex that matches the parts I need replacing it with what I want. The tool I mentioned afaik used machine learning to determine a valid regex from a given sample automagically somehow (see [1]), which was then applied to the files it found, followed by a preview and a choice to either perform or abort. You could also provide more examples, if it did not succeed determining the regex in the first place to be more specific: f2 -A 001.pdf -B 001_renamed.pdf -A 002.pdf -B 002_renamed.pdf It was awesome, unfortunately otherwise not suitable for my needs (windows only or something) I should have saved it somewhere to re-implement it myself. The only things I remember are, that it was dotnet based, using the dotnet machine learning libs and it was a command line tool. Maybe it was called `ab` because you could provide the parameter -A sample -B destination, but I did not find anything on github. If I ever find it again, I'll let you know in a github issue. 1: https://stackoverflow.com/questions/616292/is-it-possible-for-a-computer-to-learn-a-regular-expression-by-user-provided-e https://stackoverflow.com/questions/616292/is-it-possible-fo...