2

For instance I am looking for something in a bigger text file - very simple for example a string of three digits with \d{3} . What I want to do is: when notepad++/textpad has found the first matching string in a line (and has replaced it with something else) it should jump immediately into the next line.

How can I accomplish that?

I tried \r\n , but in this case textpad finds not the first string with three digits in the line, but always the last. And notepad++ doesn't find anything at all.

I cannot use ^ either because there are some random words (one, two, three or even foru or five) before the digits I try to find and replace.

Thanks for any help.

4

1 回答 1

1

为此,您必须将所有剩余的行包含到匹配的模式中。

例如,假设您搜索\d{3}并拥有以下数据:

qweqwe 123 rrr 445
test tetst
41 423 456

搜索\d{3}(.*$)

替换REPLACEMENT$1

会给你以下结果:

qweqwe REPLACEMENT rrr 445
test tetst
41 REPLACEMENT 456

如果您没有包含剩余的行 ( .*),结果将是:

qweqwe REPLACEMENT rrr REPLACEMENT
test tetst
41 REPLACEMENT REPLACEMENT

在 Notepad++ 中,要使其工作,您必须取消选中“.matches newline”选项。

于 2013-11-04T23:44:25.887 回答