Skip to content

Instantly share code, notes, and snippets.

@RyanABailey
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save RyanABailey/329ee701b2516e12d202 to your computer and use it in GitHub Desktop.

Select an option

Save RyanABailey/329ee701b2516e12d202 to your computer and use it in GitHub Desktop.
LINQ Regex
var testList = new [] {"You may concatenate a string.", "They have a cat.", "Cat is a feline.", "Her name is Catherine."};
var regex = new Regex(@"(^|\W)cat", RegexOptions.IgnoreCase | RegexOptions.Multiline);
var matches = testList.Where (l => rexex.IsMatch(l));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment