Notepad++ Get only words which contains some string from a Text

notepadregexsearch

I would like to get only words which containing specific string in notepad++ result. There are tons of examples for finding word but non oftem showing how to get only those words in result page.

For example DE2KXXXXXX -> there are different of this word (X ares different strings in text document)

So i want to get only these words not whole line. i checked everywhere and it shows only get lines which containing words or strings.

But my request is only get words containing string as start with DX2K and 6 string in word.

I just want to copy all of them to my excel. But notepad++ is getting whole line in result.

Below, X are any string maybe A-Z or 0-9 . So it will start with D and third character is 2 and 4th is K and then strings.

Example text:

The right-click > W > T DE2K12XXXX shortcut eliminates DE2K1XX3XX the need to open Notepad first. It will create a text DE2K1XX5XX document ready for file DE2K1XXXXX naming and then all you have to do DX2K1X5XXX is hit Enter to open the text DE2K1XXX4X document for editing (hit CTRL+S to save DE2K1X2XXX your changes and you've got a very DE2K1XX3XX streamlined text-document-creating workflow).

Notepad++ Result must be:

DE2K12XXXX
DE2K1XX3XX
DE2K1XX5XX
DE2K1XXXXX
DX2K1X5XXX
DE2K1XXX4X
DE2K1X2XXX
DE2K1XX3XX

Best Answer

Do it this way:

Step 1 : Replace all using

Search string: (DE2K\w*)
Replace string: \n\1\n

This will give the following result on your test data:

enter image description here

Step 2 : Do Mark All of the same string DE2K(\w*) with the option "Bookmark line", giving:

enter image description here

Step 3 : Use menu Search > Bookmark > Remove Unmarked Lines, giving:

enter image description here

Related Question