The quick brown fox jumps over the lazy dog" is an English-language pangram, alphabet! that is, a phrase that contains all of the letters of the alphabet. It has been used to test typewriters alphabet. and computer keyboards, and in other applications involving all of the letters in the English alphabet.
我需要得到“字母表”。正则表达式中的单词。在上面的文本中有 3 个实例。它不应包括“字母表!”。我刚刚用
尝试了正则表达式 MatchCollection match = Regex.Matches(entireText, "alphabet.");
但这会返回 4 个实例,包括“alphabet!”。如何省略这个并只得到“字母表”。
最佳答案
.
是正则表达式中的一个特殊字符,可以匹配任何内容。尝试转义它:
MatchCollection match = Regex.Matches(entireText, @"alphabet\.");
关于C# 正则表达式将单词与点匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5696921/