How can I extract certain values from a string?
For example, I have the following string...
version: 51.9.0 built on Feb 12 2007 12:01:35, gcc: 3.4.5 (mingw special) Seems stream 0 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 25.00 (25/1) Input #0, flv, from 'c:\videos\testvideo.flv': Duration: 00:04:19.1, start: 0.000000, bitrate: 64 kb/s Stream #0.0: Video: flv, yuv420p, 320x240, 25.00 fps(r) Stream #0.1: Audio: mp3, 22050 Hz, mono, 64 kb/s
Now, I need to extract the following values...
flv (which is always next to Video: )
00:04:19.1 (which is always next to Duration: )
I tried the following:
<cfset duration_ = #listgetat(result,55," ")#>
<cfif right(duration_, 1) is ",">
<cfset duration_ = left(duration_, len(duration_)-1)>
But the problem is that the order of the word count changes constantly and I get different results, so I think the safest way to do this is to target the values next to the keywords (Duration, Video).