What you would expect to be the result of PatternCount ( "¶1¶1¶2¶3¶1¶" ; "¶1¶" ) ?
Am I wrong to expect 3? It's returning 2 in FMA14 & FMA16.
Separator between matched string is eaten by first matching, so the 2nd "1" doesn't have opening separator.
You need double separator.
PatternCount ( Substitute ( string ; "¶" ; "¶¶" ) ; "¶" & search & "¶" )
2 is Correct. Think in terms removing a pattern, increment count, check the remaining chunk, repeat.
The Help topic has some good examples. PatternCount
Sent from miPhone
Interesting and thanks for looking.
As I see it, there are three instances of ‘1’ bounded by carriage returns and I wouldn’t have expected to need to manipulate data to make a function report correctly. But if that’s intended behaviour then I’ll have to live with it, I guess.
If you expect 3, then there may be custom functions that increment along the searches text, one character at a time. If the length of the possible match is compared starting at each iteration of the “loop”, the the count increments if the is an “exact” match. I say Exact() because some people may wish for the option to be case-sensitive and others don’t care.
I cannot search custom functions right now.
See if these help (Advance tools setting required to add):
FileMaker Custom Function: CountWordOccurrences ( text ; searchWord )
FileMaker Custom Function: ExactPatternCount ( text ; searchString )
Great shout, user19752; thank you!
Retrieving data ...