Forum Academy Marketplace Showcase Pricing Features

What REGEX function can I use to obtain the avgpricepaid in the following scenario

I am trying to extract the avgpricepaid for a given ID. I have got the following regex to match an ID, but now I’m not sure how to extract the avgprice. Ideally, I would want to extract the entire number between the parenthesis.

The data structure looks like this:


My current regex is just (“81”) which represents someone search for token with the id “81”, and then I want to extract the price which is 0.37383279375209605. If someone inputted “124” then the regex should return 2.7141224777939494 and so on. Appreciate any help with this. Thanks

This should work (?<="124"\s*:\s*{\s*"avgPricePaid"\s*:\s*")[^"]+(?=").
You just have to replace the 124 with user’s input.

A problem like this would be better solved with JavaScript tho but I don’t know Bubble enough to recommend an alternative solution.

1 Like

Hey @nypro ,

Yeah unfortunately I can’t find how to use javascript in backend workflow actions. I tried your REGEX and couldn’t get it to work.

I have used the following regex which is working, but I can’t find a way to make it exclusive.


I think use some stuff in bubble to split the result (highlighted in blue) by " and then call the last item which essentially gives me the number. The problem is that it gives me this result for id 1 and id 81 because 1 is in 81. Do you know how to specify in regex to only match “81” and not “81” and “1”

Similarly, If i search 1, I only want that result. I have simulated that case below.

I think the fix is a simple symbol in regex but I can’t figure it out.

Would love some assistance. Thanks

Ah I’ve found the fix, just had to add " at the start to include the paranthesis.

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