Extracting Image from Bubble's Rich Text Input (REGEX)

Hi -
I need help figuring out how to extract image URLs from the content saved by Bubble’s Rich Text Input . I don’t know much about REGEX, suspect that this can be done this way? Does anyone know how to write a REGEX expression for this?

Below I’m pasting a sample block of data that would come from Bubble’s rich text input when someone inserts an image:

[img width=783px]https://s3.amazonaws.com/appforest_uf/f1647244218647x353208091323034000/richtext_content.png[/img-]

(NOTE: there normally wouldn’t be a “-” between “[/img” and “]” but if I take that out in this post the bubble forum will actually insert the image.

Thanks!

Hello,

You can start with this kind of regex

/https:\/\/.+\.[a-z]{1,}/

I just did a quick test and it looks like it’s working pretty well, but you should go to regex101.com and try different cases to make sure it covers all use cases.

1 Like

Wow that works perfectly thanks so much. - Bubble actually doesn’t add “Https:” to the image link for some reason, but I just dropped that from your string and it now works perfectly! Thank you again!

The working string is:
image

1 Like

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