I need a regex to return true for 01.mp4

Posted by Umair on Stack Overflow See other posts from Stack Overflow or by Umair
Published on 2010-06-08T07:58:41Z Indexed on 2010/06/08 8:02 UTC
Read the original article Hit count: 401

Filed under:
|
|

I want to sort out specific files depending on their names, i want a regex that returns true for file names like : 01.mp4, 99.avi, 05.mpg.

the file extensions must match exactly to the ones that i want and the filename must start with characters which can not be longer than 2 characters. the first part is done but the file extensions aren't working. need some help the regex that I have is

/^[0-9]{1,2}\.[mp4|mpg|avi]*/

but it also returns true for 01.4mp4, 01.4mp4m.

© Stack Overflow or respective owner

Related posts about php

Related posts about regex