Search and replace
-
i cannot fix the regular expressions for that :/
Suppose you have this text:
some text [1 Box]
somer other text [200 Boxes]
1 Comments
200 Commentsi would get this text:
some text
some other text
Comments
Comments(Value 1<) Thank you.
-
See the last post (5/23/17) in this thread:
https://notepad-plus-plus.org/community/topic/13823/replace-function/47
Npp can’t do it automatically by copy-and-paste. You need add \r\n at the end of each line in the text to Replace with, then delete the EOLs.
Several other editors accept direct copy and paste in the replace-with box, be it CR+LF, LF or combination of both. They are probably written in C++. But I think it can be done in any language since CR and LF have the same codes.\r\n\r\nDon is busy now with other issues in 7.4.1. I saw there are problems with replacing again in several open files.\r\n
-
from the given sample you can use two simple regex to get the result.
First, to get rid of the text encased by[ ]
find what:\[.*?\]
and replace with nothing.
To get rid of the numbers
find what:\d+
and replace with nothing.
If there are other numbers in your text which should be kept, that you might use\d+\s+(Comments)
and replace with
$1
Cheers
Claudia -
The easiest way, without regex:
-
Select the bloc you wanna replace and press Ctrl+H. Npp fills the Find what box automatically, with the proper codes inserted (although invisible, unless you try Find in files first; the results panel will show the Find string with the \r\n codes inserted properly).
-
Select the text to Replace with. Unfortunately, Notepad++ does NOT fill the box with the proper codes automatically. You need insert the \r\n codes at the end of each line manually.
some text**\r\n**
some other text**\r\n**
Comments**\r\n**
Comments**\r\n**
\r\n
(Value 1<)\r\nGo to the end of each line and press Delete (it deletes the EOL codes, LF or CRLF).
- It is a one line bloc now. Select the new bloc of text and paste it into the Replace with box:
some text**\r\nsome other text\r\nComments\r\nComments\r\n****\r\n***(Value 1<)*\r\n
Voilà!
-