1

I'm working on TextWrangler, I want to delete every word from a text that doesn't have an hashtag before. Example:

Looking for a simple #homemade gift for the #holidays? 
This #DairyFree #DarkChocolate #Fudge recipe is simple and absolutely delicious: http://sddf.us/fudge

I would like to have only

#homemade #holidays #DairyFree #DarkChocolate #Fudge

also I would like to use TextWrangler, because I know nothing about Java and PHP. I used this regular expression #\w+ which select the hashtag words, but I don't understand how to delete everything else. Thank you

Sufian Latif
  • 13,086
  • 3
  • 33
  • 70
nadiaeagle
  • 47
  • 5

1 Answers1

2

You can replace all (^|\s|[^#\w])+[^#\s]+ by empty strings.

Demo

Sufian Latif
  • 13,086
  • 3
  • 33
  • 70
  • Welcome to StackOverflow! If you find an answer useful, no need to say thanks, just mark the answer as accepted (i.e. click the checkmark to the left of the answer). – Sufian Latif Dec 11 '15 at 12:22
  • As this answered your question, please [accept it as an answer](http://meta.stackexchange.com/a/5235/246338). – ʰᵈˑ Dec 11 '15 at 12:22