Escaping a plus symbol before numbers

Hello everyone,

I am trying to basically add a +61 onto the start of a number if it is only 10 numbers long but im having an issue with the + symbol. the result I want to get is below but just without the “” around the +61 but whenever i take it out the + is only recognised as a symbol and does not show. I have tried multiple things and do not want to have to add an extra operation for this specific problem as it will rack up with the amount it gets used. Any Ideas?
Screenshot 2024-08-29 at 2.53.46 pm
Screenshot 2024-08-29 at 2.52.54 pm

I don’t think the error is the + sign. This is what your function says. If length of 21.$1 is equal to 10 return +61 and the portion of the text 21.$1 from position 1 to __. Otherwise return 21.$1

Yeah so basically it is checking for a phone number that is formatted like 0444444444 and then taking the 0 off and adding a +61 on, so if the number is already +61444444444 then it will just return that number which is already in the right format.

The issue is the + symbol is just registered as a special character so disappears unless i have another character in front of it which i do not want as I want all numbers to go to my air table in the same format not sure if that makes a bit more sense sorry probably the way i worded it?

Hello fellow Australian!

You need to do a little “hack” because the input fields do not like a plus symbol before digits, and it converts it into a positive number.

So you should structure your input like this to split up the + and numbers to keep them as text, to prevent them from being “recognised” as a number:

replace(+|61; |; emptystring)

You can copy-paste this full solution into your field, and replace 1.phone with your phone variable.

{{replace(1.phone; "/^0/"; replace("+|61"; "|"; emptystring))}}

Example output

Screenshot_20240829_182318

Module Export - quick import into your scenario

You can copy and paste this module export into your scenario. This will import the modules (with fields/settings/filters) shown in my screenshots above.

  1. Move your mouse over the line of code below. Copy the JSON by clicking the copy button on the right of the code, which looks like this:

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the editor.

  3. Click on each imported module and re-save it for validation. There may be some errors prompting you to remap some variables and connections.

JSON module export — paste this directly in your scenario

{"subflows":[{"flow":[{"id":2,"module":"util:SetVariable2","version":1,"parameters":{},"mapper":{"name":"intl_phone","scope":"roundtrip","value":"{{replace(1.phone; \"/^0/\"; replace(\"+|61\"; \"|\"; emptystring))}}"},"metadata":{"designer":{"x":0,"y":0,"name":"Convert Phone to Intl Format"}}}]}],"metadata":{"version":1}}

Note: Did you know you can reduce the size of blueprints and module export code like the above, using the Make Blueprint Scrubber?

Hope this helps! Let me know if there are any further questions or issues.

@samliew


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!

1 Like

Thank you this works perfectly, you are definitely not in this community to f spiders :laughing:

Just for my own understanding what does the /^0/ mean I cant quite get that part but assuming it means if starts with 0 or something?

yes. that means starting with 0