我需要在具有開始和結束空格的字符串中查找單詞。我在搜索空白處發現問題。但是,我可以實現以下。從@@
開始並結束。任何有關空格的幫助都會很棒。正則表達式,以查找以空格開頭並以空格結尾的所有單詞
string input = "@@[email protected]@ @@[email protected]@";
foreach (Match match in Regex.Matches(input, @"@@\b\S+?\[email protected]@"))
{
messagebox.show(match.Groups[1].Value);
}
我有這個「(\\ $ \\ w +)」,它查找以$開頭並以空格結尾的單詞。但我需要以空格開始並以空格結束的單詞。 – Robin