help with {n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /\$2, \$1/)}
Posted: 11 Jan 2020, 04:06
Hello everyone,
I have cobbled together a naming scheme from other peoples suggestions. If I have the word The, A, or An in the beginning, I like to have it be at the end of the title after a coma (for example the big lebowski => big lebowski, the) I was using {n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /\$2, \$1/)} to do this, but sometimes filebot will put the files into a folder called $2, $1 and I am not sure why. Here is what I think is happening
n = name
replaceFirst is the command to replace the first word it finds
Not sure about the ^(?i)
(The|A|An) are the things it is looking for to replace
\s(.+) not sure
and don't know what the $2, $1 is for but I think it is the pattern that gets filled in from the first part of the command.
I only get a little of the regex so any help would be appreciated.
Thanks
I have cobbled together a naming scheme from other peoples suggestions. If I have the word The, A, or An in the beginning, I like to have it be at the end of the title after a coma (for example the big lebowski => big lebowski, the) I was using {n.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /\$2, \$1/)} to do this, but sometimes filebot will put the files into a folder called $2, $1 and I am not sure why. Here is what I think is happening
n = name
replaceFirst is the command to replace the first word it finds
Not sure about the ^(?i)
(The|A|An) are the things it is looking for to replace
\s(.+) not sure
and don't know what the $2, $1 is for but I think it is the pattern that gets filled in from the first part of the command.
I only get a little of the regex so any help would be appreciated.
Thanks