Regex to determine if a file is a rar file
i've been messing around trying figure this out myself but its taking a while..
Basically after a r开发者_如何学Cegex to pass the following tests:
IsARarFile("test.rar"); // true
IsARarFile("test.r00"); // true
IsARarFile("test.txt"); // false
IsARarFile("test.avi"); // false
IsARarFile("test.mp4"); // false
IsARarFile("test.001"); // true
IsARarFile("test.ba00"); // false
Thanks for any help
\.(?:rar|r\d\d|\d\d\d)$
I think.
Edit: Credit to Peter for another correction.
([^\.]+)\.(r(ar|\d\d)|\d{3})$
精彩评论