我有以下文字"a|mother" "b|father"我想通过Regex查找以'"'开头,以'"'结尾,并以'|'分隔且不带空格的文本组。这意味着结果将是:
"a|mother" "b|father"
'"'
'|'
"a|mother"
"b|father"
u5i3ibmn1#
就像这样:
String source = "\"a|mother\" \"b|father\""; var result = Regex .Matches(source, "\"[^\"]*[^ ]\\|[^ ][^\"]*\"") .OfType<Match>(); Console.Write(String.Join(Environment.NewLine, result));
输出为
1条答案
按热度按时间u5i3ibmn1#
就像这样:
输出为