Add a comma in a "number" string

Hi all! I’m getting via API Connector a string ID (e.g. 111111) I use to search in my Bubble DB for an entry with that same ID. The problem is, in my Bubble DB, the ID has a comma everty 3 digits (e.g. 111,111), and it’s a string, not a number. I see 2 options:

  1. I modify my 20k entries in the DB to get rid of the comma (with “find&replace”). This will take long and I’m affraid some of the entries don’t get changed (and it’s difficult to find which entries have failed, I guess).
  2. I hardcode a comma in the ID I receive via API to make it something like 111,111 and being able to query the DB.

How can I do the thing in step 2? When I select “formatted as”, I can only chose between phone, URL and a couple more things, but nothing helpful. Any ideas?

Thanks a lot!

Use find and replace, choose the ‘use a regex pattern’ option and put this in as the Regex pattern (\d)(?=(\d{3})+$) and this as the replace by $1,

1 Like

That is genius, @mguerrasio!!! Thanks a lot! Actually, I’ve been testing your pattern (using this website: and I get perfect results when I use your pattern (\d)(?=(\d{3})+$) and as “replace by” I use $0, (instead of your $1). Otherwise, I don’t add the comma after every 3 digits. Does it make sense to you? The thing is, if I try $0, it writes weird things on Bubble (if the ID is 53680, it writes 5$0,680), and if I use your “replace by” in Bubble, there are no changes… Any ideas? :slight_smile:

I found the problem: the “replace by” is $1, (including the comma after the “1”)! :slight_smile:slight_smile:

This topic was automatically closed after 70 days. New replies are no longer allowed.