jQuery Case Insensitive Pattern Matching Regex

Goal: Find all links to .doc(x), .xls(x), .ppt(x), zip, mov, mp3, mp4, vsd, and .pdf and add a lowercase (styled with smallcaps) filetype marker after each, unless the link contains an image.

$("a").filter( function(){
  return (/.+\.(pdf|do[c|t]x?|xlsx?|pp[s|t]x?|zip|mp[3|4]|mov|vsd)/i).test($(this).attr('href'));
  }).not(":has(img)").each( function(){ 
  var h=$(this).attr('href').toLowerCase().replace(/.+\.(pdf|do[c|t]x?|xlsx?|pp[s|t]x?|zip|mp[3|4]|mov|vsd).*/, "$1");
  $(this).after("<span class='marker'>"+h+"</span>"); 
});

Example:

lowercase doc file
lowercase pdf file
uppercase PPT file
uppercase PDF file
title case Pdf file
uppercase DOC file
pdf file with a bookmark hash
uppercase XLS file
linked image: kitties hate Excel!

Notes

  1. You can change .filter() to .not() to reverse the logic

  2. You can choose whatever action you want to do with the links -- apply additional styles, insert content, selective hide/show, etc. The choice is up to you.
  3. Why did I choose this option? Isn't using a regular expression slower than just natively building out a stack of natural selectors? -- yes, but the list of selectors can get ridiculously long, and I'd rather see this in my code:

    $("a").filter(function(){
       return (/.+\.(pdf|do[c|t]x?|xlsx?|pp[s|t]x?|pot|zip|mp[3|4]|mov|vsd)/i).test($(this).attr('href'));
    })

    than dozens of case sensitive selectors, like
    
        $('a[href*=".pdf"],a[href*=".PDF"],a[href*=".Pdf"],
        a[href*=".doc"],a[href*=".DOC"],a[href*=".Doc"],
        a[href*=".docx"],a[href*=".DOCX"],a[href*=".Docx"],
        a[href*=".dot"],a[href*=".DOT"],a[href*=".Dot"],
        a[href*=".dotx"],a[href*=".DOTX"],a[href*=".Dotx"],
        a[href*=".xls"],a[href*=".XLS"],a[href*=".Xls"],
        a[href*=".xlsx"],a[href*=".XLSX"],a[href*=".Xlsx"],
        a[href*=".pps"],a[href*=".PPS"],a[href*=".Pps"],
        a[href*=".ppt"],a[href*=".PPT"],a[href*=".Ppt"],
        a[href*=".pptx"],a[href*=".PPTX"],a[href*=".Pptx"],
        a[href*=".pot"],a[href*=".POT"],a[href*=".Pot"],
        a[href*=".zip"],a[href*=".ZIP"],a[href*=".Zip"],
        a[href*=".mp3"],a[href*=".MP3"],a[href*=".Mp3"],
        a[href*=".mp4"],a[href*=".MP4"],a[href*=".Mp4"],
        a[href*=".mov"],a[href*=".MOV"],a[href*=".Mov"],
        a[href*=".vsd"],a[href*=".VSD"],a[href*=".Vsd"]')
    particularly if you need to combine numerous :has() and :not() options in that stack.