Author Topic: Removing a single digit from multiple captions.  (Read 946 times)

Offline mbbphoto

  • Sr. Member
  • ****
  • Posts: 312
    • View Profile
Removing a single digit from multiple captions.
« on: September 28, 2023, 05:43:16 AM »
I accidentally inserted a digit (the number 4) at the beginning of the caption field in about a thousand photos.
The caption varies in length and content so I cant use find and replace.
How can I remove the digit from all the captions?
Thanks
Marc
Marc

Offline RogerB

  • Newcomer
  • *
  • Posts: 36
    • View Profile
Re: Removing a single digit from multiple captions.
« Reply #1 on: September 28, 2023, 08:16:01 AM »
If I'm understanding your problem correctly you have captions that now look like this:

  4This is a caption
  4This is also a caption

You can use a regular expression Find and Replace to get rid of the digit 4 at the start of the caption.  I've tried to attach a screenshot of how to set up the Find and Replace window, hopefully it is visible.  You need to search for:

  ^4(.*)

which means find a digit 4 at the start of the line followed by 1 or more characters, then in the Replace box put

  \1

which is a back reference to whatever is in the parenthesis of the Find string.

Set the serach criteria to Metadata, check the Grep box and restrict the search to the caption field.

I've tested it here and it sems to work OK, but please try it out on a couple of images before applying it to 1000 of them, and/or make sure you have backups!

Edited to add: The screenshot isn't very clear on what to put in the Find box as the cursor was in the way when I took it.  The text needed is shown above.

Offline mbbphoto

  • Sr. Member
  • ****
  • Posts: 312
    • View Profile
Re: Removing a single digit from multiple captions.
« Reply #2 on: September 28, 2023, 08:28:50 AM »
I am profoundly in your debt!
Many thanks
Marc
Marc