Using Regex for word counts

I am trying to use ‘extract with regex’ to do a count of how many times some words appear in a multiline text input.

The expression I am using is along these lines:

\bTHING|\bITEM|\bFOO

That is exactly what I am entering it in to where it says ‘Regex pattern’ in Bubble. I’ve tried it just as it is and also surrounded by square brackets, i.e.

And then on the Appearance tab I am entering this:

MultilineInput A’s value: extract with regex:count

What I need is a count of how many times the words thing, item and foo have been used in the multiline input that has been referenced.

So,

The thing is that the foo item is just the thing that I need, or maybe another item might be okay.

would give the answer 5.

Problem is I am getting some kind of character count rather than a count of those three words. Where am I going wrong?

Why \b?
Try (foo|item)

The \ was to create a word boundary as I understand it.

I’ve not got 90% of tge way there with this expression:

(\b(?:US|UK|Greece|Germany|Nigeria|Brazil)\b)

Does anyone know how to modify it so that it will work whether the word has a cap or not, or is in uppercase or not, e.g. uk, greece, Uk, GREECE.

I thought it was /i, but not sure, and it doesn’t seem to work when I add /i outside of the bracket or inside the bracket.

Any ideas?

use :lowercase like in my example

Hi @Jici

I’m being a bit thick, but I can’t see your example that is using :lowercase

Where should I be looking?

ss05

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