if( $string =~ m/MTV\s*=\s*(0x[a-f0-9]+)/i ) { print $1, "\n"; } #### if( $string =~ m/MTV\s*=\s*(0x[[:xdigit:]]+)/ ) { print $1, "\n"; }