# How to Format Number

**URL:** <https://community.glideapps.com/t/how-to-format-number/73080>\
**Category:** Ask for Help\
**Created:** [May 4, 2024, 8:31pm UTC](https://community.glideapps.com/t/how-to-format-number/73080 "2024-05-04T20:31:21Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [May 4, 2024, 8:31pm UTC](https://community.glideapps.com/t/how-to-format-number/73080/1 "2024-05-04T20:31:21Z")

</div>

Hi

Need help to format a number

24555333000141 entered in a form

Formated as  
24.555.333/0001-41

regards,  
Paulo Novas

---

<div class="post-metadata">

**Author:** ![Eric\_Penn](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/eric_penn/32/73888_2.png) [@Eric\_Penn](https://community.glideapps.com/u/Eric_Penn)\
**Post date:** [May 4, 2024, 8:52pm UTC](https://community.glideapps.com/t/how-to-format-number/73080/2 "2024-05-04T20:52:03Z")

</div>

5 text slice and a template column but I’d probably ask chat GPT for a little Java script

---

<div class="post-metadata">

**Author:** ![raajkumars](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/raajkumars/32/74046_2.png) [@raajkumars](https://community.glideapps.com/u/raajkumars)\
**Post date:** [May 4, 2024, 10:39pm UTC](https://community.glideapps.com/t/how-to-format-number/73080/3 "2024-05-04T22:39:52Z")

</div>

Javascript with regex pattern would better. I tried using template with pattern matching first. It requires too much work.

```javascript
return p1.replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/, "$1.$2.$3/$4-$5")

```

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [May 5, 2024, 12:13am UTC](https://community.glideapps.com/t/how-to-format-number/73080/4 "2024-05-05T00:13:55Z")

</div>

Hi Raajkumars,

Thanks, i do not know if i did it right, got an error

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/8/5/85c56ce6291b306cb2769e849d1d35e3c6bf5d94.png)

---

<div class="post-metadata">

**Author:** ![ThinhDinh](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/thinhdinh/32/49_2.png) [@ThinhDinh](https://community.glideapps.com/u/ThinhDinh)\
**Post date:** [May 5, 2024, 1:17am UTC](https://community.glideapps.com/t/how-to-format-number/73080/5 "2024-05-05T01:17:12Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/2/b2c3c4332f81ef99888d833c3aaa433312a37ecc.png)

Please convert it to a string first:

```auto
return p1.toString().replace(/(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})/, '$1.$2.$3/$4-$5');

```

---

<div class="post-metadata">

**Author:** ![raajkumars](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/raajkumars/32/74046_2.png) [@raajkumars](https://community.glideapps.com/u/raajkumars)\
**Post date:** [May 5, 2024, 1:44am UTC](https://community.glideapps.com/t/how-to-format-number/73080/6 "2024-05-05T01:44:46Z")

</div>

I am sorry. I assumed that you are storing that long number as a string. if it is a number then you have to convert it to a string as suggested by @ThinhDinh

---

<div class="post-metadata">

**Author:** ![Paulo\_Novas](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/paulo_novas/32/73277_2.png) [@Paulo\_Novas](https://community.glideapps.com/u/Paulo_Novas)\
**Post date:** [May 5, 2024, 2:03am UTC](https://community.glideapps.com/t/how-to-format-number/73080/7 "2024-05-05T02:03:25Z")

</div>

Hi

Many thanks, working perfect!

regards,
