How does regex work in Bubble?


did anyone use regex in the find and replace function (or somewhere else if thats possible)?

I want to use regex on a Input where the user enters a URL and I extract a specific part of the URL (which is always somewhere else in the URL)

I am reffering to this post by emmanuel:

So I have this regex /([a-zA-Z0-9]{10})(?:[/?]|$) which works great in Excel/Google sheets. But I dont know where I should put it so that the input will be “converted”?

Can anybody help?

Thanks you guys.

1 Like

Why don’t you try and expose a page? Otherwise it’s a bit hard to help for anyone.

Thanks. My problem is that I dont even know where the regex could be placed? I did not find anything about that in the documentation. Do I have to put it in “Find & Replace” or somewhere else? And if so, how do I put it, do I have to write something like “regextract” etc.

So, I made some examples in the forumapp, Emmanuel. Would be great if you or somebody else could help! At the moment I am using blockspring and google sheets for this. But I think it is not necessary and only slows down the app because I have to send data to blockspring.

Yes, you put in in Find and replace, and there you type what you’re trying to find. Don’t think in regex terms, just type what you’re looking first. Don’t do REGEX = XXX (The point of bubble is that you don’t have to do this :))


Thanks, Emmanuel!

I thought, the thing with a regex is that it does not only find & replace letters.
Because an Amazon URL can look very different everytime.

I was successfull with extracting the ASIN with the following regex:

I think this works because it does not only find & replace some letters but also knows “where” to look in the URL for a specific part of it.

Like explained by somebody on stackoferflow:

_“Since the ASIN is always a sequence of 10 letters and/or numbers immediately after a slash, try this: url.match(”/([a-zA-Z0-9]{10})(?:[/?]|$)")"

Sorry for all the dumb questions but I still dont know how to do that with Find & Replace.

Behind the scene we do this

regex = new RegExp(find, 'g')

so find should be what you put there.


Man…I think I am to stupid for this…

So, I just put in the expression which should be extracted from the string in the part "FInd (text or regex)

And what happens is (of course) it would replace the part I defined with whatever I type into “Replace by”.

But…what I need is exactly the other way around…replace everything but the ASIN and keep it…(which works this way when I use this regex in excel or google sheets. But of course there is not “replace by” function attached to it.

Why don’t you experiment in JSFiddle? The question here isn’t about Bubble, it’s a Javascript question.

1 Like

I created an example to extract the ID. Yes you can use REGEX but need a base in JavaScript, and using the HTML icon, and pass variables, or use the other option you mentioned.



After >>:

Hey John,

thank you for your help and all the time you invested just to help me!

I played with the demo and the app a bit. My only problem now would be: How do I get the extracted ID (B00RQA6E20) “out” of the HTML? SO I can use it in a workflow?

If i’m correct, send data to API Connector. I used API Connector to received info from outside world, and working fine (using the software PostMan before to validated the API Connector response). Writing code in JavaScript to communicate with Bubble API Connector is the challenge. Send me the code when done :slight_smile:

I had the same issue as @Pat: trying to extract the product id from an Amazon link. This was one of the few threads I came across while searching for help, so I’m putting my solution here for the next person.

Start with a text input where the user pastes an Amazon link.
Add a submit button that triggers the following workflow:

Step 1

  • Create a new thing …
  • item id = Input amazon link’s value: extract with Regex. Regex pattern = dp/.{10}

Step 2

  • Make changes to a thing …
  • item id = Result of Step 1’s item id: extract with Regex. Regex pattern = .{10}$

Amazon link format:

Result of Step 1

  • dp/[10 digit item id]

Result of Step 2

  • [10 digit item id]

Hello @emmanuel, how do I use regex to prevent users from entering emojis in the input field when signing up.

1 Like

Hi @emmanuel

please check the below scrnsht

I get weekdays from API response in text format.
Basically that text has seven characters, for Mon-sun.
when char is “1” that means Mon flag is true. And when it is “0” then I have to show nothing.
if text is 1010101 that means i want to show " Mon,Wed, Fri, Sun " in the text field.

How i can read each character from text and then apply condition on that to check whether it is 1 or 0?

Thank you in advance.