Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#正则表达式仅在每个句子中第一个匹配_C#_Regex - Fatal编程技术网

c#正则表达式仅在每个句子中第一个匹配

c#正则表达式仅在每个句子中第一个匹配,c#,regex,C#,Regex,我几乎有我的正则表达式,但后来我有一个问题,我无法得到修复 句子: oListView.StranSlatedPreder= gsTranslate(oClientInfo,“Lastschriftenstapel”)&“& gsGetDBValue(oClientInfo,“BatchDesc”, “tdDebitAdviceBatches”、“BatchID=“&lBatchID”) 回答。写(Dictionary.gsTranslate(oClientinfo),“Es konten ke

我几乎有我的正则表达式,但后来我有一个问题,我无法得到修复

句子:

oListView.StranSlatedPreder= gsTranslate(oClientInfo,“Lastschriftenstapel”)&“& gsGetDBValue(oClientInfo,“BatchDesc”, “tdDebitAdviceBatches”、“BatchID=“&lBatchID”)

回答。写(Dictionary.gsTranslate(oClientinfo),“Es konten keine 在奥斯瓦尔·达格斯特尔特·沃登的《设计手册》中 trotzdem modifiziert werden。”)

正则表达式:

(?<=[D-d]ictionary\.gs[T-t]ranslate.*?, ?)( ?")((.|\n|\r)*?"\))

“在奥斯瓦尔-达格斯特尔特-沃登的设计中有一个很好的例子,
”和“在设计中有一个很好的例子。”)

小提示:有一个包含多个匹配项的完整文件。所以我不想要文本中的第一个匹配,我想要每个
字典之后的第一个匹配。gsTranslate

从我所看到的,这个\n | \r允许匹配包含并超过“BatchDesc”。。。由于换行符应使用下划线字符(我在您的文本中看到的)继续,因此这可能适合您的需要:

(?<=[D-d]ictionary\.gs[T-t]ranslate.*?, ?)("(.|\_ ?\n|\_ ?\r)*?"(?=\)))

(?您可以使用以下正则表达式:


(?
(?@ctwheels完美无瑕!谢谢你我将其转换为答案我收到一个错误:
System.ArgumentException:'parsing'(?@NielsLucas对于所有出现的
\\\\\
你需要将它们转义。将它们更改为
\\\\\\/code>@Kit啊,谢谢!今天晚些时候我会尝试,即使我已经有了答案,我也想尝试其他解决方案。
(?-I)
没有区别,后面没有字母可以匹配。
"Es konnten keine Befehle in der Auswahl dargestellt werden,<br>" & _ "das Design kann trotzdem modifiziert werden.")
(?<=[D-d]ictionary\.gs[T-t]ranslate.*?, ?)("(.|\_ ?\n|\_ ?\r)*?"(?=\)))
(?<=(?i)dictionary\.gstranslate\([^)]+, *)"[^)]+"
# or the following with RegexOptions.IgnoreCase
(?<=dictionary\.gstranslate\([^)]+, *)"[^)]+"