Regex to Extract #hashtags from MMD metadata in Python

Viewed 326

I'm trying to extract all the #hashtags from the "Tags: #tag1 #tag2" line of a multimarkdown plaintext file. (I'm in Python multiline mode.)

I've tried using lookaheads:

^(?=Tags:\s.*)#(\w+)\b

and lookbehinds:

#(\w+)\b(?<=Tags:^\s)

Plain vanilla #(\w+)\b works, except it picks up any #hashtag that might appear later in the document.

Any hints, help, instruction appreciated.

2 Answers
Related