Regular expressions in exiftool; how to search for whitespace, digits, letters

Started by slim, February 02, 2022, 12:27:09 PM

Previous topic - Next topic

slim

[EDIT: I solved it but I can't remove my own post]

I have a set of photos with a 'triggermode' tag, and the options are either 'Motion Detection' or 'Time Lapse.' I am renaming the files to include MD or TL. That chunk of code is:
${triggermode;s/(.)(.*\\s)(.)(.*)/$1$3/
However, it's currently including the full trigger mode ('Motion Detection' or 'Time Lapse').

I've also tried
${triggermode;s/(\\w)(\\w*\\s+)(\\w)(\\w*)/$1$3/
Are \\w and \\s not acceptable regular expressions in exiftool? Or are the parentheses not an acceptable way to subset the pattern?

Thanks!

Edit: I'm used to using regular expressions in R, in which case I need the double backslashes, but since I was running this in command line, I didn't realize that I only need single backslashes. Problem solved!