How to copy marked text in notepad++

Alex picture Alex · Feb 19, 2010 · Viewed 125.4k times · Source

I have a part of HTML source file that contains strings that I want to select and copy at once, using the regex functionality of Notepad++.

Here is a part of the text source:

<option value="Performance"
>Performance</option>
<option value="Maintenance"
>Maintenance</option>
<option value="System Stability"
>System Stability</option>

I'm using the regex "[0-9a-zA-Z ]*" to search the "value" values. I have also selected the feature in Notepad++ search to highlight/mark the found text. This working fine I now want to copy or cut only the highlighted text to clipboard for further processing. But I'm not able to find this functionality in Notepad++. Is this simply not possible or am I too dumb?

Answer

Colin picture Colin · Nov 22, 2011

As of Notepad++ 5.9 they added a feature to 'Remove Unmarked Lines' which can be used to strip away everything that you don't want along with some search and replaces for the other text on each value line.

  1. Use the Search-->Find-->Mark functionality to mark each line you want to keep/copy and remember to tick 'Bookmark Line' before marking the text
  2. Select Search-->Bookmark-->Remove Unmarked Lines
  3. Use Search-->Find-->Replace to replace other text you do not want to keep/copy with nothing
  4. Save the remaining text or copy it.

You can also do a similar thing using Search-->Bookmark-->Copy Bookmarked Lines

So technically you still cannot copy marked text, but you can bookmark lines with marked text and then perform various operations on bookmarked or unmarked lines.