【发布时间】:2014-03-07 20:16:13
【问题描述】:
我在这里遇到了一个简单的正则表达式问题。 我想从特定字符串中检索使用以下规则完成的所有子字符串: 1. 值在 TAB 之间。 2. 还包括双引号。
我该怎么做?
我找到了获取 TAB 之间值的方法,但我不知道如何包含双引号验证。
'get the text from clipboard
Dim stringInClipboard As String = ClipboardGet()
Dim vRegExMatch As System.Text.RegularExpressions.MatchCollection = System.Text.RegularExpressions.Regex.Matches(stringInClipboard, "\t[^\t\\]*(?:\\.[^\t\\]*)*\t")
例子:
{Tab} Comment 1 {Tab}
{Tab} Comment 2 {Tab}
{Tab} Long comment text.
some text
.
"<--Double quotes!!!
.
{Tab}
{Tab} Comment 4 {Tab}
基本上,我想检索:
Long comment text.
some text
.
"<--Double quotes!!!
.
【问题讨论】:
-
请澄清一下,它是用 \t 还是用 "" 包围的值,还是更像 \t"value"\t ?
-
\tnot all "matches\twill" occur\t