in reply to Re: Regex: remove non-adjacent duplicate hashtags (updated)
in thread Regex: remove non-adjacent duplicate hashtags

Thanks, it works. Here's my more elaborated version:

$tags=~s/(#\S{2,}\b)(.*\s?)(\1)(\s?.*)/$3$2$4/g;