using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"(?!.*:).";
string input = @"Hilary: YOU KNOW, THIS IS NOT WHY I CAME HERE.
Devon: DOESN'T MATTER.
Hilary: IT DOES. DEVON, WHEN I SAY THAT I'M TIRED OF SNEAKING AROUND, I MEANT IT.
Devon: DON'T GET UPSET, THOUGH.
Hilary: HOW CAN I NOT? I MEAN, LOOK AT WHAT I DID.
Devon: HONEY, HONEY, WE'RE IN LOVE WITH EACH OTHER. OKAY? AND WE KNOW EXACTLY WHAT WE HAVE TO DO. WE'RE GONNA TELL NEIL THE TRUTH.
Hilary: NOW?
Dr. Barrett: I THINK YOU CAN PROVIDE SOME VALUABLE INSIGHT INTO PHYLLIS NEWMAN'S RECENT STATE OF MIND.";
RegexOptions options = RegexOptions.Multiline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx