我想在文件中搜索特定(变量)字。
private int read_inv(string file, string part) // part = SCRAP
{
string text = File.ReadAllText(invFolder + file + ".inv");
string find = @"(?i)\bSCRAP\b"; // this return 3 like it should be
string find = @"(?i)\b"+part+"\b"; // this return 0
Regex r = new Regex(find);
MatchCollection matches = r.Matches(text);
int iCount = matches.Count;
return matches.Count;
}