in reply to Parsing of a string
Something like this...
if( $string =~ m/MTV\s*=\s*(0x[a-f0-9]+)/i ) { print $1, "\n"; }
It's just a matter of anchoring to something predictable, and capturing the right pattern. ;)
Update: By the way, [a-f0-9] could also be represented by [[:xdigit:]] The POSIX character class for a hexidecimal digit. In that case, the RE would look like this:
if( $string =~ m/MTV\s*=\s*(0x[[:xdigit:]]+)/ ) { print $1, "\n"; }
It's not really gaining anything to spell it that way, but perhaps could be seen as a little clearer reading.
Dave
|
|---|