Method I Wish Was There: RegexIsMatch

I don’t like the verbosity of a couple days ago use of Regex(). That is not to say that I don’t still find the Regex extension method useful, but if I’m just matching I should say so.

var re = @“\d+-\d+-\d+-\d+”.Regex();
var match = re.Match(“things 10-12-5-1”);
//do things with match
var othermatch = re.Match(“stuff 1-6-8-9”);

Regex extension method is great. But for a Boolean statement I should be able to just say “RegexIsMatch?”

if ( someText.RegexIsMatch(@”\d+\.\d+”) ) …