How to write a logic similar to FileMaker's Patterncount? or what is the function I can use?


How do you search to see if a string is contained in another string?
Example: if BF_Text1 has a string of text in it “Today is a good day”. How do I write a logic to test if BF_Text1 contains “good”? I want to use it in “values_calc” so a JSON object can conditionally show or hide.

A while ago I learned from fmbf team to use Lodash’s function to filter value. Example: “_.filter(model.BF_Text1 , {‘venue’ : ‘Canberra Theatre’}).length” which is great. But that seems to work for array only. Now I just want to search a string within a string (hence like Patterncount).

I tried to look up manual for Loadash, Numeral and Moment but didn’t have much luck. Clumsy at JS still.

Thanks in advance,


If you just want to emulate pattern count in a string you can use includes
see here: JavaScript String includes() Method

No need for loadash on this one.


Cool. thanks :+1:. I tried but didn’t work. Tried to spot something to try but didn’t see this one. I will try this one in a moment. Thanks a million again.