This is an example on how to find & replace a phrase in a string, the easy way in C# :
using System.Text.RegularExpressions;
....
if (Regex.IsMatch(content, searchText, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
display.Text += "Found match in " + filePath +" ***\n";
content = Regex.Replace(content, searchText, replaceText);
}
No comments:
Post a Comment