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
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?
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?
EDIT: Simplified this a bit:
Which gives us:
Looking to accelerate your app development?
Let me turn
Development through Coaching at https://uniqueideas.com or schedule a free intro session
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!
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.
This topic was automatically closed after 70 days. New replies are no longer allowed.