using System.Text.RegularExpressions;
public static void Main()
const string shortagePattern = @"^([^\.]+)(?:\.)?(\d+)?$";
Regex shortageRegex = new Regex(shortagePattern, RegexOptions.Compiled);
var match = shortageRegex.Match("urn:GangNbr:787333179");
if (match.Groups.Count == 3)
int.TryParse(match.Groups[2].Value, out shortCount);
Console.WriteLine(match.Groups[1].Value + "." + shortCount);
Console.WriteLine("No match");