im looking for a regular expression that checks or it is an tv show or just a movie by searching for by example S01E01 in "24.S01E01.DVDRip.XviD-FoV.avi"
so i
bool check = Regex.IsMatch(filename, "^(*[a-z][A-Z][0-9].){*}S\\d\\dE\\d\\d(*[a-z][A-Z][0-9].){*}")
but it doesn’t look like visual studio is very happy with that…
does anywone has a sugestion?
Happy downloading..
Ah now I get it.. You want to know why your regex doesn’t work.. Well..
(*[a-z][A-Z][0-9].)this is wrong.You can’t have a quantifier pointing nothing. Here
*matches greedily 0 to n times of nothing.. Error.This means to match one letter from a-z followed by one letter from A-Z followed by one number from 0-9 followed by anything. So you are looking for aA1# or something. What you probably really meant to write was :
\w*which matches 0 to n times of [a-zA-Z0-9_]Also wrong.. Match the
{as many times as possible followed by}? See above for what you really meant.Also wrong. You meant to match a digit but what you do actually search here is a
\followed by the letterd.Etc. I suggest you start reading some regex tutorial.