using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @/
(\d+)[^\d]*[^\w]some[wW]ord[^\w]
/;
string input = @"43434 of someword 12 anything 45 someword 2323 new someword
43434 of someWord 12 anything someWord 2323 new someWord
43434 of notsomeWord 12 anything someWordNotThis 2323 new notsomeWord
";
foreach (Match m in Regex.Matches(input, pattern))
{
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