我有以下内容:
The moment #BTC, we have all $BTC been waiting for:We are happy to announce NIX Platform is rebranding to.. $NBT > $VOICE $NIX > $MUTE $ETH $BTC #BTC
我希望仅删除以 # 或 $ 结尾的单词,不删除中间的单词,因此上述字符串将看起来像这样。
The moment #BTC, we have all $BTC been waiting for:We are happy to announce NIX Platform is rebranding to.. > >
目前我有一个正则表达式#(?!(?:hashtag)\b)[\w-]+(?=(?:\s+#[\w-]+)*\s*$)
,它可以除去以#结尾但不是以$结尾的单词,不太确定我需要怎么修改才能包括以$结尾的单词。
[#@$]\w+\b(?!\W*\s\w)
- anubhava