Put simply, I want to shorten text from a FB post to a limit of 500 characters and if it is shortened, add “ …” at the end. Yet for some reason this isn’t matching/replacing despite working in regex testers. There is no error and the full string is returned.
P.S.: Did you know, the concepts of about 70% of questions asked on this forum are already covered in the Make Academy. Investing some effort into it will save you lots of time and frustration using Make later!
Do you have an example of using the if function in this way? I originally turned to regex replace after some other thread stating it wasn’t possible any other way, but that was years ago.
EDIT: The other reason for using regex was to not split it in the middle of a word…
Okay so I used substring temporarily just to get past a really long post that was holding up my queue, then tried some other things.
I can’t get if() to work right. I tried checking if length(7.message)>500 but it seems to ALWAYS evaluate to true. So it always adds ellipsis to the message.
I figured I would test your theory about multiple regex flags and I switched it from /gs to just /s but it still didn’t replace anything.
If you struggle with functions, try using a router and filters instead.
If you need further assistance, please provide the following:
1. Relevant Screenshots
Please share screenshots of your scenario, any error messages, relevant module fields, and filters in question? It would really help other community members to see what you’re looking at.
You can upload images here using the Upload icon in the text editor:
2. Scenario Blueprint
Please export the scenario blueprint file to allow others to view the mapped variables in the module fields. At the bottom of the scenario editor, you can click on the three dots to find the Export Blueprint menu item.
3. Output Bundles of Modules
Please provide the output bundles of the modules by running the scenario (or get from the scenario History tab), then click the white speech bubble on the top-right of each module and select “Download input/output bundles”.
A. Upload as Text File
Save each bundle contents in your text editor as a bundle.txt file, and upload it here into this discussion thread.
B. Insert as Formatted Code Block
If you are unable to upload files on this forum, alternatively you can paste the formatted bundles.
These are the two ways to format text so that it won’t be modified by the forum:
Method 1: Type code block manually
Add three backticks ``` before and after the content/bundle, like this:
``` content goes here
```
Method 2. Highlight and click the format button in the editor
Providing the input/output bundles will allow others to replicate what is going on in the scenario even if they do not use the external service.
Following these steps will allow others to assist you here. Thanks!
Had another long post break my scenario again. Obviously editing this just to get past a long post each time is not ideal. The weird thing is, I’ve had this scenario for years and this problem (and non-functional regex replace) has only started in the last month. And I KNOW I tested it when I created it originally, and the replacement was working at the time.
I looked at your links and that’s great for not breaking in the middle of words. But it doesn’t solve “if” not working…
I don’t want to use a filter because there’s a lot of stuff going into the Discord embedded message that I don’t want to duplicate/maintain two separate versions just for message length!