Regex for Notepad++ to select everything but hashtags. Replace with nothing or space. Done!

Regex for Notepad++ to select everything but hashtags.  Replace with nothing or space.  Done!

hashtag extraction.

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

Selects all not-hashtagged stuff.  Replace it with a space or nothing.  Done!

hint: To keep separate lines:

FIRST: Replace ## with #
THEN: Replace \r\n with ##\r\n

THEN: Replace (?<!#)\b[^#]+  with nothing
THEN: Replace ##\r\n with \r\n

In my case, I needed to enclose them in <subject></subject>
So I continued this way:

Replace \r\n with </subject>\r\n

then replace: # with  </subject><subject>

then replace: \r\n</subject> with \r\n

DONE!

 

Leave a comment

Your email address will not be published. Required fields are marked *


8 − seven =

Leave a Reply