using System; using System.Collections; using System.Collections.Generic; using System.Text; using System.Globalization; using System.Text.RegularExpressions; namespace Enum { class Program { static void Main(string[] args) { string sql = "INSERT INTO TABLE1(col1, col2, col3, col4, col5) VALUES (,NULL, NULL, NULL, NULL, NULL,)"; string nulls = "NULL"; List indexes = new List(); foreach (Match match in Regex.Matches(sql, nulls)) { indexes.Add(match.Index); } sql = sql.Remove(indexes[2], 4).Insert(indexes[2], "'abc'"); Console.WriteLine(sql); } } }