Domanda

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.

È stato utile?

Soluzione

To do that, you have to include all the remaining of your line into the matching pattern.

For example, let's say that you search for \d{3} and have the following data:

qweqwe 123 rrr 445
test tetst
41 423 456

Search for: \d{3}(.*$)

Replace: REPLACEMENT$1

Will give you the following result:

qweqwe REPLACEMENT rrr 445
test tetst
41 REPLACEMENT 456

If you didn't had included the remaining line (.*) the result would be:

qweqwe REPLACEMENT rrr REPLACEMENT
test tetst
41 REPLACEMENT REPLACEMENT

In Notepad++ to make this work, you must leave the ". matches newline" option unchecked.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top