This "Regular Expression" stuff makes a window guy dizzy

Started by Thorkil, January 20, 2018, 12:25:57 PM

Previous topic - Next topic

Thorkil

Hi
I am able to figure out 'equel to' like here: exiftool *.mp3 -if "$Comment =~ 'Fest'"

What i really want is to figure out in $Comment contains 'M:' or 'm:'

Can anyone help ?

Thanks in advance

StarGeek

Dare I point out that the first command would have to be exiftool *.mp3 -if "$Comment =~/Fest/"  ;)

Try this command
exiftool -if "$Comment=~/m:/i"

The trailing i makes the regex case insensitive.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

Actually, "$Comment =~ 'Fest'" does work to find "Fest" in the comment because Perl allows you to choose your delimiter after "=~".

- Phil
...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 ($).

Thorkil

Thanks for a nice program and a quick reply.

Can I squeze this a bit more: What I am actually after is files where the string :m followed by three digits, like M:345 og m:666
Zero is not allowed. Low=111 and high is 999

Thanks in advance
/T

Phil Harvey

This should do it:

exiftool -if "$Comment=~/m:(\d{3})/i and $1>=111" ...

- Phil
...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 ($).