简体   繁体   English

替换记事本++中两个单词和两个单词之间的所有内容

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

I have a text like this我有这样的文字

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

want make it like this in Notepad++ using replace and regular expression想要在 Notepad++ 中使用替换和正则表达式做到这一点

0367118 06 - 10 000071
0367121 06 - 10 000074

want to replace all between two word Bank and Applicants and also those word too with none.想要将两个词 Bank 和 Applicant 之间的所有内容以及这些词也替换为 none。

Bank.*Applicants does work except unchecking "matchs new line", so what you need to do is to check this box. Bank.*Applicants除了取消选中“匹配新行”外确实有效,因此您需要做的是选中此框。 I test it on Notepad ++ 6.4.5.我在记事本 ++ 6.4.5 上对其进行了测试。

Just open replace dialog window.只需打开替换对话框窗口。

Select Regular expression and tick .选择正则表达式并勾选 matches newlines .匹配换行符

Into find what type: Bank.*Applicants进入寻找什么类型:银行。*申请人

Click replace all.单击全部替换。

i think you want to do some programatically我想你想以编程方式做一些

This may be help you :这可能会帮助你:

Click here 点击这里

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

I think you are looking for a more generic solution than specifically replacing on the words "Bank" and "Applicants".我认为您正在寻找一种更通用的解决方案,而不是专门替换“银行”和“申请人”这两个词。 Otherwise, you would do this manually.否则,您将手动执行此操作。

So here's how to search for that type of code and replace what's in between:因此,这里是如何搜索该类型的代码并替换其间的代码:

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

Be sure you are using the "regular expression" mode, with ". matches newline" checked.确保您使用的是“正则表达式”模式,并选中“.matches newline”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM