Help with regex in make to trim string

Hi everyone,
I’m trying to use regex to trim a string coming from a Notion database item. This is a tweet title that has between 0-3 tags at the end. I got the regex working at regex101.com, which you can see here: regex101.com here is expression

^(?:(?:.*?#.*?)?((?:(?!\s#)[\s\S]){0,280}))

The requirement I wanted to implement was if the 280 limit intersects a hashtag, I want the entire hashtag removed.
I tried the following string:
:wave: Hey there, Twitterverse! We’re Wise Leaf AI, and we’re bringing cutting-edge AI to the healthcare industry. Follow us for exciting updates on our innovative solutions for practitioners. This tweet is longer by a number of chars than 280 #AIforHerbalists #WiseLeafAI #InnovativeSolutions

On regex101.com it worked and returned:
:wave: Hey there, Twitterverse! We’re Wise Leaf AI, and we’re bringing cutting-edge AI to the healthcare industry. Follow us for exciting updates on our innovative solutions for practitioners. This tweet is longer by a number of chars than 280 #AIforHerbalists

But when I try the expression in the Text Parser module, it doesn’t seem to be working the same.
Any suggestions?
Thanks kindly!



Hi @Emilio_Gagliardi,

Not sure what is the issue, the first screenshot has the result and text parsing looks good and it is returning the result.

Thank you for replying @Runcorn I’d love to get this working.
So the issue is two-fold. One is I don’t understand the module output for the Text Parser. In the second screenshot, the Output Bundle 1: $1 → AIforHealth, not the result of the Text Parser, at least that’s what it looks like. In the Operation 2, Output Bundle 1: $1 → AIforHerbalists. That doesn’t make sense to me. The output should either be the original string or the trimmed version. Thats what I was expecting.
The second issue is that at regex101.com, the exact same regex expression and tweets resulted in a correctly trimmed version.
If I run this Scenario, the full length strings are being added to the Data Store, not the trimmed versions. The first tweet is below 280 so that’s fine, but the second tweet is longer than 280, its 289 so it should be trimmed, but it isn’t.
Does that make more sense?