【发布时间】:2015-09-29 23:39:09
【问题描述】:
我在 C# 中有一个长字符串,其格式为 \\server\value 我一直在使用 "(?
我正在尝试使用 MatchCollection 使用模式 (?=\\)
提取所有服务器名称第一个分组结构中用于说明 ' 字符的句点。我希望结果返回 3 次,但它只返回 1。我的模式有什么问题?
string expression = "'\\\\serverA\\value1' + '\\\\serverB\\value2' + '\\\\serverC\\value3'";
string pattern = @"(?<=\\\\).*(?=\\)";
MatchCollection matches;
matches = Regex.Matches(expression, pattern);
【问题讨论】: