Regex Question (case)

Hi there,

I’ve got something like this in my app which is simply taking what I type into an input field, matching the text as you type and then making it bold in the results so I can highlight specific search criteria which I’ll then be using later on.

So it looks like this…

I type the word “Test” and in the results it just finds that word and replaces it with the same word but wrapped in the bold tags [b] [/b]


And in the Editor, it’s like this:

My problem is that I don’t just want it to match on “Test”, I kind of need it to also match on “test”, “Test”, “TEST” … you get the idea. So how do we do that?

I’ve tried various Regex patterns in the Find & Replace dialog and ideally I only need to set the /i Flag so it ignores case when trying to find the text? Not sure, but whatever I try seems to fail, wondered if anyone knew how to make this work like I want to?

I’ve been trying to do it in Bubble’s Regex Tester as if I can get it working in there then I should be fine.

In this example, looking for “sarah” would also need to work with “Sarah”, “SARAH” etc…

Can it be done?


Hey @pork1977gm,

Interesting problem. As you note, this can easily be done in a typical regex using the case insensitive flag, however I don’t think Bubble supports regex flags. It looks like Bubble prepends the regex string with a slash to start the search, and appends with another slash to close it. Regex flags however come after the trailing slash, so we have no way to add the “i” which would be a quick win for you!

@neerja any chance the Bubble regex implementation does in fact support flags? Could support be added?

Now, how about a solution for today without flags. This can be done in javascript using the Expression element from the Toolbox plugin. fullString will be the entire search result string from the repeating group. extractString is the input value to be found, but case insensitive. res is the result where we replace any occurrence of the input, again case insensitive, and insert the bold tags.

EDIT: Simplified this a bit:

Which gives us:

Looking to accelerate your app development?

Let me turn
:thinking: :tired_face: :confounded:

:grinning: :sunglasses: :woman_student:

Development through Coaching at or schedule a free intro session :gift:

Ken Truesdale


Hi @mebeingken

Many thanks for taking the time to put that together, that’s just great! and very much appreciated.

I had noticed those surrounding slashes being applied to the Regex string and suspected the same as you. Be nice if there was support for regex flags, even a tick box saying “ignore case” that becomes visible when the “Use a regex pattern” is ticked perhaps.

I’ve just tried your suggestion and it works a treat so thanks again. Learned something new in the Bubble community today! :slight_smile:

Actually that’s the first time I’ve had to use that Expression Builder, I understand how that works now, going to be very useful I suspect.


1 Like

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