I'm trying to find match between a string and pattern using Regex.IsMatch(). I framed the regex and tested it using regex101.com it works fine. Now problem is that
Regex.IsMatch(filename, curSetting.RegExMatch.ToString());
returns true
curSetting.RegExMatch.IsMatch(filename))
returns false for same filename. Can someone explain how does this differ and what is the difference between them?
RegExMatch
is my regex member of curSetting
object. Test data in my case is Pattern is
Gen(?!.*(?:erallog))(?<SerialNo>.+?)-(?<Year>(?:\d{2}))(?<Month>\d{2})(?<Day>\d{2})(?<Other>.*?\.log)
The string is 1_GeneralLog1370013-170403.log
.