using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @"\bfrom company\b.*?\b(?<!\$|[\d.])(\d+)\b";
string input = @"This is invoice from company XYZ - $1234545 product name 31h10 , $456.12 product number g456, 123f 456 information invoice unit cost $12.0 and invoice total $1343.00
This is invoice from company ABC - 1234545 product name and information invoice total cost $6777 and invoice unit cost $654";
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