簡體   English   中英

RegEx匹配兩個單詞首次出現之間的所有內容,這兩個單詞都出現多次

[英]RegEx to match everything between first occurrence of two words, both of which appear more than once

我收到一封電子郵件,其中需要提取數據。 我正在使用Nintex Workflows RegEx操作,並選擇了提取功能。 我使用在線.NET正則表達式測試器來驗證它是否可以在工作流中正常工作。

我的數據就是這樣。

There is some extra information here that is not needed

WHEN: 12 12:34Z - 12 45:67Z May 16 (I need everything after WHEN:\s until EOL)
WHERE: Around (I do not need this line)

There is some extra information here that is not needed

WHEN: 12 12:34Z - 12 45:67Z May 16 (Duplicate data not needed)
WHERE: Around (I do not need this line)

There is some extra information here that is not needed

我正在使用以下代碼在兩個關鍵字之間進行捕獲。 問題在於它仍然匹配重復數據(?s)(?<=WHEN:\\s).*?(?=WHERE:)

.NET正則表達式示例

此正則表達式應在第一個“時間:”之后獲取數據:

^WHEN:\s(.*?)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM