Author Topic: A grep question: searching for keywords.  (Read 128 times)

Offline Skids

  • Newcomer
  • *
  • Posts: 43
    • View Profile
A grep question: searching for keywords.
« on: Yesterday at 08:21:01 AM »
Hi,
Is it possible to use the grep in the Find pane to select all images in the contact sheet that have the keyword "family" while excluding those that are have both "family" and "pet" ?

I have tried
Code: [Select]
^(?=.*family)(?!.*pet) but it does not work and my new best mate Claude Ai talks about there being a lack of "lookahead" in the implementation of grep in Photo Mechanic.  Now Claude makes loads of mistakes hence this post.

Offline ahoward

  • Camera Bits Staff
  • Uber Member
  • *****
  • Posts: 1396
    • View Profile
Re: A grep question: searching for keywords.
« Reply #1 on: Yesterday at 10:43:04 AM »
I believe this should work

Offline ahoward

  • Camera Bits Staff
  • Uber Member
  • *****
  • Posts: 1396
    • View Profile
Re: A grep question: searching for keywords.
« Reply #2 on: Yesterday at 10:47:00 AM »
Actually, what you have works for me as well. Did you have "Treat repeating fields as a single string" checked?

Offline Skids

  • Newcomer
  • *
  • Posts: 43
    • View Profile
Re: A grep question: searching for keywords.
« Reply #3 on: Yesterday at 01:45:03 PM »
Actually, what you have works for me as well. Did you have "Treat repeating fields as a single string" checked?

First, thank you for your posts.   

Yes I had the catchy "Treat repeating fields as a single string" ticked.  However, I also had "Whole words" ticked and this prevented the regex from working.  Once it was unticked both strings returned the desired results.  I need to read about regex but guess that it is a character based search tool meaning "whole words" make little sense.  If that is the case then it would be useful if the UI deselected it when Grep is ticked.

S

Offline Skids

  • Newcomer
  • *
  • Posts: 43
    • View Profile
Re: A grep question: searching for keywords.
« Reply #4 on: Today at 03:13:32 AM »
I decided that I needed to learn more about regex and its use in Photo Mechanic Find actions.  I have written some notes that hope other regex tiros will find helpful.

S