EXIF Command to Parse String Between 2 Underscores

Started by jmiller, January 12, 2023, 03:14:47 PM

Previous topic - Next topic

jmiller

Hi Everyone,

I previously had an EXIF Regex command I had created to extract a string between two underscores in a filename and write it into the Model XMP attribute. After picking up my project after a couple of weeks, suddenly its not working. Can someone point me to how to adjust the REGEX to get this working?

Example:
10010088_1_.jpg

Command:
exiftool "-Model<${Filename;s/_([^_]+)_"

Result:
10010088_1_.jpg;s_([^_]+)_

Desired Result:
1

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).