Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy marked text in notepad++

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?

like image 626
Alex Avatar asked Feb 19 '10 19:02

Alex


People also ask

How do I copy a marked line in Notepad ++?

1 Answer. Show activity on this post. Total 2 lines were bookmarked. now go to "search" menu > bookmark > copy bookmarked line.

How do you copy a section in notepad?

From the NotePad tab, select the cell of information you want to cut or copy. To cut the information, click Cut on the speedbar. To copy the information in the cell, click Copy on the speedbar. Select the cell where you want to paste the information.

How do I select a specific text in Notepad ++?

Place your cursor at the beginning position where you want to begin selecting text. Press and hold the “Shift” and “Alt” keys on your keyboard. Continue holding “Shift” and “Alt” while using the “Down” and “Right” arrow keys on your keyboard to select the text as desired.


2 Answers

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.

like image 189
Colin Avatar answered Sep 23 '22 11:09

Colin


I am adding this for completeness as this post hits high in Google search results.

You can actually copy all from a regex search, just not in one step.

  1. Use Mark under Search and enter the regex in Find What.
  2. Select Bookmark Line and click Mark All.
  3. Click Search -> Bookmark -> Copy Bookmarked Lines.
  4. Paste into a new document.
  5. You may need to remove some unwanted text in the line that was not part of the regex with a search and replace.
like image 24
gschoep Avatar answered Sep 24 '22 11:09

gschoep