my $pathex2 = qr/[0-9A-F]{2}/i; # exactly 2 hex digits my $pathex2p = qr/[0-9A-F]{2,}/i; # 2 or more hex digits my $pathexX1t4= qr/[0-9A-FX]{1,4}/i; # 1-4 hex/X digits my $pathexX1t8= qr/[0-9A-FX]{1,8}/i; # 1-8 hex/X digits my $patopt_h = qr/h?/i; # optional trailing H/h my $patoptname= qr/(?:\"[^\"]+\")?/; # optional quoted literal (name) my $patint = qr/\bINT\s?$pathex2$patopt_h/; # INT my $patmem_16_16 = qr/\bMEM\s?$pathexX1t4$patopt_h:$pathexX1t4$patopt_h/; # MEM : my $patmem_32 = qr/\bMEM\s?$pathexX1t8$patopt_h/; # MEM my $patportrange = qr/ \bPORT\s?$pathexX1t4$patopt_h\-$pathexX1t4$patopt_h/x; # PORT my $patportsingle= qr/\bPORT\s?$pathexX1t4$patopt_h/; # PORT my $pattable = qr/\#[0-9A-Z][0-9]{4}\b/; # #<4 digits> my $pataccureg = qr/\bE?A[XHL]=$pathex2p$patopt_h/; # EAX/AH/AL assignment my $patregequ = qr/ (?:E?[ABCD][XHL]|E?[SD]I|E?[SB]P|[DESC]S)=$pathex2p$patopt_h /x; # a single register entry my $patreglists = qr/ (?:\/$patregequ)+ /x; # one or more "/" entries our $hyperlinkpattern = qr/ # 1. INT with register list and optional name (? $patint $patreglists $patoptname ) | # 2. INT with only optional name (? $patint $patoptname ) | # 3. EAX\/AH\/AL equation with optional register list and optional name (? $pataccureg (?:\/$patregequ)* $patoptname ) | # 4. Table reference (? $pattable ) | # 5. MEM far address (addr:addr) with optional name (? $patmem_16_16 $patoptname ) | # 6. MEM single address with optional name (? $patmem_32 $patoptname ) | # 7. @ reference (addr:addr) with optional name (? \@$pathexX1t4$patopt_h:$pathexX1t4$patopt_h $patoptname ) | # 8. PORT range with optional name (? $patportrange $patoptname ) | # 9. PORT single value with optional name (? $patportsingle $patoptname ) /x;