Regular Expression To Match RAR Archive Files

A regular expression to match and validate RAR Archive Files.

/^\.([rR]([aA][rR]|\d{2})|(\d{3})?)$/

Matches:

  • .rar
  • .r01
  • .r05

Non-matches:

  • .zip
  • .gz
  • .a01

See Also: