2017-05-29 176 views
-1

在NPP中,我需要搜索/從"Installed"行開始一直搜索/替換爲"Rx Coding Error",包括尾隨數字(隨機,任意長度),還包括尾部換行符。正則表達式npp - 由兩個字符串包圍的搜索字符串

我有這個正則表達式到目前爲止,它匹配所有的一切到Rx Coding Error,但看不到如何添加額外的whitespace + colon + random numbers/length + newline

\b\s+Installed[\s\S]*?Rx Coding Error\b 

我正在尋找類似於以下代碼塊:
EFM Link 1/2/3 on EFM Group 3/2/1 is ENABLED and UP Installed : YES Near end tc sync : SYNC Rx Coding Error : 595237

regex101 fiddle to play with

+0

我看不清楚輸出。請指定它。 – revo

+1

您是否期待https://regex101.com/r/F84BKW/2? –

回答

1

上@ SahilGulati的回答擴展:

^\s+Installed[\s\S]*?Rx Coding Error\s+:\s+\d+\s+

應該做的工作,假設你想從同一條線上的Installed

https://regex101.com/r/F84BKW/4

+0

你釘了它 - 非常感謝 – crashwap

+0

很高興知道它有幫助!我希望這不會成爲劣勢,但如果你想進一步改進正則表達式,那麼我可以建議玩[正則高爾夫](https://alf.nu/RegexGolf)。 – SWLim

1

與以下的正則表達式嘗試啓動。

正則表達式:^\s*Installed[\s\S]*Rx Coding Error.*它將匹配字符串直到行尾。

enter image description here

+1

關閉,但沒有得到尾隨的換行符 - 儘管你比我做得更多,謝謝! – crashwap

相關問題