I need a function/plugin to extract only unnecessary text from lines
-
I need a function/plugin to extract only unnecessary text from lines
Notepad++ v8.7.1 (64-bit)
Build time : Oct 31 2024 - 00:48:56
Path : C:\Program Files\Notepad++\notepad++.exe
Command Line : “C:\Users\RagnarLodbrok\Desktop\chomik hity.txt”
Admin mode : ON
Local Conf mode : OFF
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 10 Enterprise LTSC 2021 (64-bit)
OS Version : 21H2
OS Build : 19044.5608
Current ANSI codepage : 1250
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4)chciałbym aby taką operację mógł wykonać, mam taki plik wiersze w pliku karolsieczko1:Kaaarolek24 | Dostępny transfer = 50 MB | Punkty = 1000 darek221:Darek221 | Dostępny transfer = 270,8 MB | Punkty = 1000 tomzdw:sztepci0 | Dostępny transfer = 127,41 MB | Punkty = 1000 rpiecuch:ra3f0p6 | Dostępny transfer = 50 MB | Punkty = 1000 morgrim9:norekk123 | Dostępny transfer = 50 MB | Punkty = 1000
and I would like to receive such a file with the words removed
this is what it would look like:karolsieczko1:Kaaarolek24 darek221:Darek221 tomzdw:sztepci0 rpiecuch:ra3f0p6
Manually deleting such texts takes days, so my question is: is there a plugin, command, or other solution? Sorry for the inquiries, but I’m completely unfamiliar with such processes. Best regards.
—
moderator added code markdown around text; please don’t forget to use the
</>
button to mark example text as “code” so that characters don’t get changed by the forum -
My suggestion: Use the Search > Replace menu action (or
Ctrl+H
as the default shortcut):- FIND WHAT =
^(\w+:\w+)?.*$(\R)?
- REPLACE WITH =
?1$1$2
- SEARCH MODE =
Regular Expression
then use REPLACE ALL button
The FIND WHAT puts any
xyz123:abc987
at the beginning of a line into memory group #1, skips over the rest of the line, and puts the newline sequence in group#2.
The REPLACE with will replace that entire line with just the contents of group#1 followed by group#2 (so thexyz123:abc987
and newline) IF thexyz123:abc987
exists; if it DOESN’T exist, it will replace the entire line with nothing (hence deleting the line)I believe this does what you want.
----
Useful References
- FIND WHAT =