using System.Text.RegularExpressions;
public static void Main()
Console.WriteLine("START HERE");
var result = GetNumberOutOfString("HLONLINE.HEALTHLINK.102", "MSH3/HD.1");
Console.WriteLine("Result is: " + result.ToString());
public static object GetNumberOutOfString(string psValue, string psField)
Match match = Regex.Match(psValue, @"\d+");
throw new Exception($"No Number Found in String: {psValue}\n{psField}");
if (!long.TryParse(match.Value, out long result))
throw new Exception($"Number Failed to Parse ('{match.Value}') in String: {psValue}");