Notepad++ how to copy the text (only) which matches the regex expression (not the whole line)

Solution 1:

I also couldn't find a way to select and copy every marked match. I'm a fairly novice NP++ user though, so maybe someone else knows how to do this.

However, you could instead search for everything you don't want to copy and replace it with nothing. This will leave you with only what you want, so you can copy it or use it as you like. Then just be sure to undo, save the result as a new file, or don't save at all in order to keep your original data intact.

Based on your comments, you're trying to grab hashtags from some text. You can use the following regex pattern to match everything but hashtags:

(?<!#)\b[^#]+

Replace all with nothing or a space.

Explanation of pattern:

\b[^#]+ maximally matches text, starting from a word boundary, that does not include a pound sign.
(?<!#) is a negative look-behind for the pound sign. This prevents matching any text immediately preceded by a pound sign.

This should leave nothing but hashtags behind. [^#]+ seems to be matching newline characters as well, so this will leave all your hashtags on a single line.