getbetween ( text, starttext, stoptext,occurrence )
gets the text between two search values
Average rating: 4.2 (33 votes) Log in to vote
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
This functions allows you to get any text in a field between two search text strings.
Updated 11/12/201 to fix somebugs.
Updated 6/1/2006 to add the ability to get the "stoptext" after the occurence of the "starttext". Before if the stoptext exist both before and after the starttext it would return nothing. Updated 8/2/2006 to add ability to leave off teh start and/or stop position and defaults to the first char and last char.
|Bill Doerrfeld, Seattle
Oct 16, 2009
|John Davis, Houston
Jul 2, 2015
|Appears this generally doesn't suffer from the "duplicate sequential values" bug that a lot of these list functions have, however this CF does fail at times.
Given this text:
and using the starttext and stoptext as both "|"
...finding occurrences 1 - 5 return the correct results,
but requesting occurrence 6 returns "Echo", when it should return null,
and requesting occurrence 7 returns the entire original string!
GetTextBetween ( text ; from ; to ; occurrence )
is the best CF like this that doesn't fail.
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.