Behind the scene we do this regex = new RegExp(find, ‘g’) so find should be what you put there.
It seems that I want is a way to specify ‘gi’ instead of just ‘g’, but not sure how to accomplish that in Bubble. I kinda worked around it by setting up multiple conditions using :capitalized words and :uppercase, but those aren’t really foolproof for my project.
Have you tried modify the regex pattern to deal with the case element, i.e. [A-Za-z] in the pattern.
if bubble where to modify the what is in the background to ignorecase (i flag, if that is what it is for), then those to do not want to ignore case would be affected.
I think the case sensitivity should reside in the expression.
Apologies in advance if I’m speaking poop, but it has been a very loooong time since I did any heavy regex stuff!
I guess I’m wondering if Bubble can/should expose an optional case-insensitive setting (making it a “gi” find) or if there is some other way to specify that in the pattern input. Putting (?i) in the pattern expression doesn’t seem to work.
That’s what the [A-Za-z] token does, in this case match upper case or lowercase character in the range Aa to Zz. So [A-Z] will not match the same as [a-z],
Thanks – had not used regextester.com before, so that’s a nice find.
Still not sure where to put that token, though. Let’s say I want to find a match of the case-insensitive string hello with word boundary.
The regex pattern is simply \bhello\b … where does that [A-Za-z] token go?
Notice also that on regextester.com, they have a little section where you can select the flags that you want. By default, it is set to global (g) but you can optionally add case-insensitive (i) as a flag. That’s kinda what I would like to have here.
Sorry, I’m not following you anymore. I can already find the string hello with word boundary using the \bhello\b pattern. What I’m looking to do extra is to be able to match either Hello or hello or HELLO or even hElLo or any other combination of upper/lowercases.
Adding the i flag would do that. Not sure what else does.
Just throwing this out there as I didn’t follow the thread too closely; you can try putting the flag modifier “(?i)” in front of your regex to indicate that it is case insensitive.
Closure: Using Regex alone I was only able to get it to pick up both Hello and hello (where ‘hello’ here is just a proxy for any dynamic text). It did not however pick up HELLO or crazy case usage like heLLo.
But leave it to Bubble to have a much simpler solution sitting there all along … I just prepended my ‘:extract with regex’ tag with a ‘lowercase’ tag, and voila, it picks up everything.