using System.Text.RegularExpressions;
using System.Collections.Generic;
public static void Main()
"DMV$101 Defective Engine AS IS - Tow Unit Previous Paintwork",
"*CARGO PKG *DMV $103 B/R ",
"*DMV$104 OVR 100*AS-IS;NO ARB ",
"*MOONROOF PKG *DMV $105 B/R 810",
"*MOONROOF PKG $DMV 106 B/R 665",
"*MOONROOF PKG $DMV $107 300B/R ",
"*MOONROOF PKG $DMV B/R 400",
string pattern = @"DMV\s*\$*(\d+(\.\d{1,2})?)|\$(\d+(\.\d{1,2})?)\s*[\s*\$]DMV";
var matches = Regex.Matches(text, pattern);
foreach (Match match in matches)
Console.WriteLine(!string.IsNullOrEmpty(match.Groups[1].Value) ? match.Groups[1].Value : match.Groups[3].Value);