You can just use regex replacements. This should work:
{
"cmd": ["parser.exe", "${file/(?:^([A-Z]):)|(\\\\)/(?1:\\/mnt\\/\\l$1)(?2:\\/)/g}"],
}
Explanation: Be aware that every backslash \
must be escaped \\
-
${file:/A/B/g}
: in the variable file
match A
and replace it by B
everywhere/globally g
Match: (?:^([A-Z]):)|(\\)
-
(?:^([A-Z]):)
-
(?:...)
hold this together, but don’t create a group
-
^
match the start of the string
-
([A-Z])
match any uppercase character and store it in group 1
-
:
match a colon
-
|
or
-
(\\)
mach a backslash \
and store it in group 2
Replace: (?1:\/mnt\/\l$1)(?2:\/)
-
(?1:\/mnt\/\l$1)
-
(?1:...)
if group 1 is not empty
-
\/mnt\/
insert /mnt/
-
\l$1
and the content of the group 1 converted to lowercase
-
(?2:\/)
if group 2 is not empty insert a slash /