Limit a text search?

Hi everyone, I’m tired today; too much to do for an old guy like me, so l’m probably forgetting something.

I’m trying to set up a tab to search all my notes for a specific set of letters, without acquiring every note with a word that happens to contain a sequence of those letters. For example I’m using

$Text.icontains(“SME”)

with the desire to search only for that acronym. However, this search also turns up words such as “assessments.”

I know this must be easy to fix, but nothing is coming easy today. Any help with how to set up the search would be appreciated.

For a start use .contains() which is case-sensitive, unlike .icontains():

$Text.contains("SME")

Will not match ‘assessment’. Better mights be:

$Text.contains("\bSME\b")

Where \b is a word boundary. This matches the exact ‘word’ “SME” whether it occurs at the beginning, within or at the end of a sentence. But let’s allow for “SMEs” which probably ought to match:

$Text.contains("\bSMEs?\b")

Now we match “SME” as above but allow zero or one lowercase ‘s’ characters at the end of the ‘word’.

See String.icontains().

1 Like

Thank you so much Mark. That is great information that will come in handy beyond my current needs!