ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: StarGeek on August 08, 2013, 04:47:43 PM

Title: Parsing tag data
Post by: StarGeek on August 08, 2013, 04:47:43 PM
I'm trying to figure out the best way to print out part of a tag, in this case the Caption-Abstract.  In the tag, there's some data I want to print out that's between an end bracket+whitespace and a whitespace+start bracket ([bbcode] Data I want [/bbcode]).  I'm currently using this command
exiftool -p "${caption-abstract;s/.*?\]\s(.*?)\s\[.*/$1/s}" <file>
and that sorta feels messy and I'm wondering if I'm missing an easier solution due to my lack of Perl knowledge.

Any thoughts/suggestions?
Title: Re: Parsing tag data
Post by: Phil Harvey on August 08, 2013, 09:04:00 PM
Sometimes regular expressions can be messy.  The only alternative I can suggest right now isn't much better:

"${caption-abstract;/\]\s*(.*?)\s*\[/;$_=$1}"

- Phil
Title: Re: Parsing tag data
Post by: StarGeek on August 10, 2013, 02:05:52 PM
Sounds good, thanks.

I was just thinking I might have been missing a simpler solution.