【发布时间】:2015-03-22 12:00:37
【问题描述】:
我对正则表达式非常陌生。我想通过忽略“in”、“of”、“the”等常用词以及逗号、反斜杠等特殊字符来搜索字符串中的多个词。
我的代码
Dim StringToSearchFrom As String = "Thus, one shifts one's focus in a variety of directions all at the same time"
Dim PhraseToSearch As String = "focus variety directions"
Dim found1 As Match = Regex.Match(StringToSearchFrom, Regex needed)
If found1.Success Then
MsgBox(found1.Index)
Else
第一个正则表达式在尝试查找并返回PhraseToSearch 的第一个单词(焦点)的索引时应忽略完整的单词“in”、“a”和“of”。谢谢
【问题讨论】: