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?
Try this instead:
First, fix the line ending problem:
(Notepad++ doesn’t allow multi-line regular expressions)
Search [Extended Mode]:
\r\n>(Or your own system’s line endings)Replace:
>then
Search [Regex Mode]:
<option[^>]+value="([^"]+)"[^>]*>.*(if you want all occurences of
valuerather than just the options, simple remove the leadingoption)Replace:
\1Explanation of the second regular expression:
Yes, it’s parsing HTML with a regex — these warnings apply — check the output carefully.