Function or text? I've spent hours on this and I'm wondering it AI is all it's cracked up to be

The goal:
simply format a number from +12021231234 (E164 format) to 202-123-1234
thats it.
I went to chat gpt (o3 model) and ask for the formula for a set variable. I got:
replace(toString(+12222222222); “(\d{3})(\d{3})(\d{4})”; “$1-$2-$3”; “regex”)

The problem is that make runs it as text and NOT a function.
Tried all the suggest (= in front, etc)
NOTHING works.
I tried make.com AI and it got it wrong also. (it was the worst of all, sorry make)

Is there no way to copy and paste a function into a make.com tools/set variable.
I love how chatgpt claims here is a function button that’s not there. (it’s not there or I don’t have the magic word I guess)

Is it possible to paste a function into a set variable value field and have it execute as a formula and NOT as text?

It must be me cause I couldn’t find this being asked before either…

Any help is appreciated.

Alfred

Followup:
First off, chatgpt and even the make ai were wrong. Consistenty. The make ai bot was even create blank modules and when filing them out, it was filling them out with incomplete formulas.

The answer was in the replace and regex documenation, that even though I pointed o3 to it, it seems it ignored it. I assumed (yeah I know) that the Make AI would have access to the latest documentation.

Google AI Studio solved the problem on the FIRST try. even gave me the {{ }} to correctly enter the expression (vs other AIs telling me to select the non-existent formula button.)
Also Google AI using the free version BTW, correctly used / for regex and described in Make Docs.

Moral of the story:

  1. Don’t trust AI for coding. it’s sometimes just plain wrong and when called on it admits it “misleads” you.
  2. Not all LLMs are created the same. Google has gotten better.
  3. Ai doesn’t always save time, I should have take the 30 seconds to read the documentation. I was being lazy and that’s on me.
  4. I am seriously considering dropping ChatGPT. Just tired of it giving me wrong info and then telling me that sorry, no more wrong answers for you today, wait for 3 hours. ($20 a month plan, no way they are getting $200 from me.)

Hope this helps some. First thing to do is read the Make docs THEN try AI if still needed.

Hey there,

yeah most AIs are glorified text generators. They are still extremely useful, just not as useful as the general public seems to think.

You can copy paste formulas directly in Make, provided the formula is properly formatted and here is where the “understanding” part of AI comes in to play - they don’t actually know what the format is, nor are they perfectly aware of the possible formulas that make supports. Here is an example of what an IF formula would look like:

{{if(1.test = "true"; "green"; "red")}}

On a side note, if you want to format a phone number, there is a built in module for that called Parse a phone number.

Yes, I am using the parse phone number but off the formats, it doesn’t have ###-###-#### which I need for my database. (and I don’t want to make the change in the database.
As far as AI you are 100% right. for example, they don’t seem to know to give us {{ }} to input their formulas into Make.

Not sure why but not even the make ai which was particularly weak. Make should really either make it work or stop it altogether.

What would be nice is having a keyboard shortcut to run this module only so we can avoid using the mouse to test out a formula…

Thanks Soyan.

All the best,

Alfred

Isnt that the international format, but without the country code that you need?

Here:

{{get(split(1.international; space); 2)}}

Replace the “1” with the number of your Parse phone number module and it should work.

I went with the Google AI studio first shot solution: (it works perfectly)
Where “phone” is the previous Make’s native phone format module (great for E164 but just doesn’t offer ###-###-####)

{{replace(phone; "/^(\d{3})(\d{3})(\d{4})$/"; "$1-$2-$3")}}