Author Topic: question metadata template  (Read 2872 times)

Offline Jaap van der Pijll

  • Newcomer
  • *
  • Posts: 37
    • View Profile
question metadata template
« on: July 20, 2023, 05:17:31 AM »
Question,

Is it possible to change only one line for all photos in the description/caption field

Rule 1, this needs to be adjusted
Rule 2, may not be modified (may also be different in each photo).

thanks, Jaap

Offline Bob Russell

  • Camera Bits Staff
  • Sr. Member
  • *****
  • Posts: 276
    • View Profile
    • Camera Bits, Inc.
Re: question metadata template
« Reply #1 on: July 20, 2023, 09:48:56 AM »
Hello Jaap,

Photo Mechanic's Find and Replace utility from the Edit menu can search for a complete sentence or part of one and then replace it with your new text. If the line you wish to change is different in some or many of your images, then you will need to perform the Find and Replace operation for each different line in the Caption field.

Photo Mechanic will not be able locate the second sentence in the Caption field and replace it with you new target sentence. I hope this helps work workflow and please let me know more about your Rule 1 & 2, if you still have questions.

Best regards,

--Bob

Offline Bob M

  • Full Member
  • ***
  • Posts: 153
    • View Profile
    • The McElroys of Point Alexander
Re: question metadata template
« Reply #2 on: July 20, 2023, 05:24:33 PM »
While I have never looked at Photo Mechanics implementation of regular expressions, this question sounds like something that regular expressions should be capable of, perhaps depending on how consistently rule 1 is separated from rule 2.  I'm quite confident that I could do it in Perl.  Is that not a possible approach?

Offline Kirk Baker

  • Senior Software Engineer
  • Camera Bits Staff
  • Superhero Member
  • *****
  • Posts: 25020
    • View Profile
    • Camera Bits, Inc.
Re: question metadata template
« Reply #3 on: July 20, 2023, 06:04:40 PM »
We use boost regex in Photo Mechanic.  The question from the OP is too vague to propose actual expressions to solve the problem.  I do not know if boost regex is 100% compatible with perl regex.  I do know that it is quite capable of doing some rather complex expressions with ease.

-Kirk

Offline Indy

  • Member
  • **
  • Posts: 52
    • View Profile
Re: question metadata template
« Reply #4 on: July 20, 2023, 10:09:25 PM »
I did some testing with regex and was able to come up with a crude find/replace regex to replace the second line of the Description / Caption field:

Code: [Select]
Find:
^(.+?)\r\n(.+?)\r\n(.*)

Replace:
$1
New second line text goes here.
$3

This works on Windows (line endings).  Find / Replace should have Metadata and Grep selected, with Description/Caption selected in the metadata field list.

It can be generalized more to replace the nth line but manual tweaking would probably still be needed to get the new lines correct.

I think this would be viable if it was a one time effort to fix a group of photos but not very easy/practical to use on a regular basis.


Offline Jaap van der Pijll

  • Newcomer
  • *
  • Posts: 37
    • View Profile
Re: question metadata template
« Reply #5 on: July 21, 2023, 02:29:02 AM »
Hello Jaap,

Photo Mechanic's Find and Replace utility from the Edit menu can search for a complete sentence or part of one and then replace it with your new text. If the line you wish to change is different in some or many of your images, then you will need to perform the Find and Replace operation for each different line in the Caption field.

Photo Mechanic will not be able locate the second sentence in the Caption field and replace it with you new target sentence. I hope this helps work workflow and please let me know more about your Rule 1 & 2, if you still have questions.

Best regards,

--Bob

Thanks for this explanation, exactly what I was looking for.