簡體   English   中英

替換記事本++中兩個單詞和兩個單詞之間的所有內容

[英]replace everything between two words and also two words in notepad++

我有這樣的文字

0367118 06 - 10 000071
Bank sl. no beginning with an 'IA' indicates ICB account
Paramount Textile Limited Page No: 113 of 258
Lottery Conducted by--Dept. of Electrical and Electronic Engineering, BUET. Date:03/10/2013
General
Applicants
0367121 06 - 10 000074

想要在 Notepad++ 中使用替換和正則表達式做到這一點

0367118 06 - 10 000071
0367121 06 - 10 000074

想要將兩個詞 Bank 和 Applicant 之間的所有內容以及這些詞也替換為 none。

Bank.*Applicants除了取消選中“匹配新行”外確實有效,因此您需要做的是選中此框。 我在記事本 ++ 6.4.5 上對其進行了測試。

只需打開替換對話框窗口。

選擇正則表達式並勾選 匹配換行符

進入尋找什么類型:銀行。*申請人

單擊全部替換。

我想你想以編程方式做一些

這可能會幫助你:

點擊這里

var result = text.replace(/(.*)Bank.+Applicants(.+)/, function(m,p1,p2) { return p1+p2;});

我認為您正在尋找一種更通用的解決方案,而不是專門替換“銀行”和“申請人”這兩個詞。 否則,您將手動執行此操作。

of code and replace what's in between:因此,這里是如何搜索該的代碼並替換其間的代碼:

Find:    (\d+ \d+ - \d+ \d+\r\n).*?(\d+ \d+ - \d+ \d+\r\n)
Replace: \1\2

確保您使用的是“正則表達式”模式,並選中“.matches newline”。

暫無
暫無

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

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