Extract with Regex empty

I want to use YouTube player w/YouTube URLs so trying to use Regex to extract the video id.
I found a Regex pattern that works (it extracts the 11 char video ID from a URL; tested w/a regex pattern tester).

My prob is that when I use …'s value: extract with Regex I get an empty result.

As shown in screenshots, I created a new field (video_userid_test) to test the Regex func’y but when running through the debugger the field always ends up ‘empty.’

I’ve tried :first item, :last item (and no item!)
I’ve tried bracketing pattern with single quotes and slashes.

I’m confident the core of the pattern works but can’t seem to get the regex ‘result’ (ie the video id) into that field. Once there, I’ll then use the video id field in the Youtube player.

Would appreciate any help w/this; thanks!

Screenshot 2020-04-13 at 8.41.36 PM Screenshot 2020-04-13 at 8.41.23 PM

1 Like

hi, could you please copy over your regex pattern so I can try? (Quite the useful functionality btw)!

And is your video userid test field a field type text or list of texts?

here’s the Regex pattern I’m using

(tested it here: https://www.phpliveregex.com/)

video_userid_test is a ‘text’ field; for now it’s just a temporary dupe of video_id that I use for the actual video player. Just want to get it to work (ie get it to be just the video id) and then will use same logic in that field and remove the video_userid_test field.

1 Like

Yeah, regex used to work. It now doesn’t. What you want is “Group 1” but no way to get it.

1 Like

So the documented ’ :extract with Regex’ func’y in Bubble doesn’t work at all anymore? Has then been confirmed by @bubble? There are all sorts of comment threads about different regex issues.

Do you know if there’s any other way to extract the video ID from a youtube URL?

actually this seems to be the one that works for most (all?) cases:

I was in touch w/Support and was told that Regex should still be working and I s/submit a bug report as trying to get that ‘Group 1’ may be a new feature that’s needed.

1 Like

Did you report this as a bug?

I thought it used to work by retrieving capture groups as list items, no? @NigelG’s comment implies that regex is broken as well. This is rather disconcerting. It’d be good to know that a bug has been officially filed so that it’s on their radar.

Did report it as bug though the the person I was connecting with in Bubble support said she didn’t think there was a regex bug (“hasn’t been touched in while”). Just trying this :extract w/Regex for first time so not an expert though it seems like get the ‘result’ from a regex pattern should be one this func’y does - but what do I know!

She thought this might be a new feature that’s required. Hopefully I’ll hear back soon.

Thanks. I could be mis-remembering how it worked, but I also know that there seems to have been a number of platform issues reported as of late, including regressions like this one where UI fields inexplicably disappeared from the Image element.

I have previously done exactly this with getting the Youtube video id - and it worked with the regex returning the id.

When I try to recreate this … it doesn’t work anymore.

Previous responses I have given on the forum indicate that it used to work in the way we think it should work, but now I can’t even get those to work.

It seems that people have transitioned to using “Find and replace” with Regex to remove stuff they don’e want.

Maybe it is me :slight_smile:

This one seems to work, and I like its brevity…


Here’s a list of all the URL variants with which it was tested. I can’t take credit, however. I got it from the library of my preferred regex tester.

Let us know if it works out for you.


WOW :star_struck:
That seems to have done the trick!

It looks like the difference between your pattern and mine is that yours delivers the video ID in both ‘groups’
Screenshot 2020-04-15 at 4.44.59 PM

My prob was I was only getting the video ID in the ‘second’ group and even using :last item wasn’t working. But getting the video ID in both groups, it does the trick!

Thanks much; this should help many of the folks w/this issue of not wanting to have to use the video ID.

Seems like there’s still a Bubble issue in that :extract with Regex can’t get anything beyond the ‘first group’ but this pattern seems to be a way around it. :joy:


Glad to hear it worked for you.

What I learned is that Bubble returns all matches as a list, whereas I thought it returned all capture groups within a match as a list. And perhaps it did work that way at one time - not sure. I certainly have no reason to doubt @NigelG that something has changed in that regard.

Anyway, happy to help. :slightly_smiling_face:

if it did return all matches as a list, I’d think that the :last item on the Regex I had (which had the ID in the ‘second’ item would have worked) but whatev…

all good now, much appreciated!

The “second item” in that case is a capture group within a match - not a separate match.

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