Regular Expression To Extract File Extension From String

Trying to extract a file extension from a string is tricky. You could use wildcard characters, or you could use phrase searches, but that’s very time-consuming and less than intuitive. So why not try using a regular expression?

This is a short Regular Expression we found on the web that helps developers quickly extract and match a file extension from a string. Enjoy!



  • regex.gif
  • regex.webp


  • regex#mp4
  • regex@mp3
  • regex jiff

See Also: