I want to remove all hashtags from a text but it should keep the first hashtag
Example text:
This is an example #DoNotRemoveThis #removethis #removethis #removethis
Expected result:
This is an example #DoNotRemoveThis
I'm using this
\#\w+\s?
but it remove all the hashtags. I want to keep the first hashtag
This may require further knowledge as to what flavour of regex you are using. For example, if .NET (C#) you can do variable length look-behind, and thus the following pattern will do what you need:
Test at Regex101
However, this won't work in most other engines.