When importing photos/videos from Instagram to Telegram, a description is transferred. But the Instagram post contains hashtags. Is it possible to remove them and leave only a text description? Perhaps the “Text parser (Replace)” module will work for this, but I don’t know how to set it up correctly.
UPD:
CAPTION NOW:
First line - Same text, smiles, etc
Second line - “Empty”
Third line - #hashtag #samehashtag #anotherhashtag #etchashtag
NEED CAPTION:
First line - Same text, smiles, etc
Done:
\B#([A-Za-z0-9]{2,})(?![~!@#$%^&*()=+_`\-\|\/'\[\]\{\}]|[?.,]*\w)
Welcome to the Make community!
You should not need a module for this.
You can use the built-in function replace
instead.
Also, here’s a simpler pattern:
/\n\n#.+$
e.g.:
{{ replace(80.caption; "/\n\n#.+$/"; emptystring) }}
Proof: https://regex101.com/r/xh2y5H/1
For more information, see the function documentation in the Help Center.
Hope this helps! Let me know if there are any further questions or issues.
— @samliew
3 Likes
One more question:
If the hashtag or hashtags contain Chinese text, this rule does not work.
#柯基犬 #合作 #柯基爱 #柯基犬 #柯基社区 #可爱柯基 #柯基世界 #科吉星球 #柯基犬 #柯基微笑 #科吉巴特 #今日之狗 #今日柯基
Is it possible to improve this simpler pattern?
{{ replace(80.caption; "/\n\n#.+$/"; emptystring) }}