Find and Replace Text in tag Caption

Started by osx96, April 25, 2024, 07:16:40 PM

Previous topic - Next topic

osx96

Hi,
How can I do to search the IPTC Caption field for ad text of this type "TEXT/TEXT/TEXT" and replace it with "1TEXT/1TEXT"?

My example is this, it works with single words but not with special characters like /

exiftool -api "Filter=s/FINDTEXT/FINDTEXT1/SOBSTITUTETEX/" -tagsfromfile @ -iptc:Caption-Abstract -xmp:Description folder


Thanks

StarGeek

Certain characters in RegEx need to be escaped. When you need to search for any of these characters
. ^ $ * + - ? ( ) [ ] { } \ | — /
You need to put a backslash before them.

-api "Filter=s/FINDTEXT\/FINDTEXT1/SOBSTITUTETEX/"
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

osx96

Quote from: StarGeek on April 25, 2024, 08:13:21 PMCertain characters in RegEx need to be escaped. When you need to search for any of these characters
. ^ $ * + - ? ( ) [ ] { } \ | — /
You need to put a backslash before them.

-api "Filter=s/FINDTEXT\/FINDTEXT1/SOBSTITUTETEX/"

Amazing, love it! many thanks!  ;D  ;D  ;D