I can't seem to figure out the regex replace syntax
Posted: 25 Feb 2015, 21:28
I'm trying to use the replace script to change from having one flat movie directory to subdirectories for each movie. But I can't seem to grok what's happening with the groovy replacement string syntax. I've tried various things but nothing seems to get me there.
For example:
Which I looks like it has two capture groups one of which matches the filename without the extension, and the second one the extension, then the replace string is trying to make a directory from the filename and put the original file there
but this produces renames like this:
As has everything else I've tried.
I noticed the GOTCHA section on this page http://groovy.codehaus.org/Regular+Expressions which led me to try various combinations of $1, ${1} etc. none of which seems to work.
For example:
Code: Select all
filebot.sh -script fn:replace --action test --def "e
=([\\^.]*?)([.].*)$" "r=\\$1/\\$1\\${2}" /volume1/video/movie
but this produces renames like this:
Code: Select all
[TEST] Rename [/volume1/video/movie/The Wild Bunch 1969.m4v] to [/volume1/video/movie/The Wild Bunch 1969/\]
I noticed the GOTCHA section on this page http://groovy.codehaus.org/Regular+Expressions which led me to try various combinations of $1, ${1} etc. none of which seems to work.