by Fabrice Nordmann, BH&A
v.1.1, Feb 2008
returns empty if searchString1 is not found
v.1, Mar 2007
extracts the middle of a text in between delimiters, based on a search strings and an occurrence numbers
occurrences can be positive (starting from the beginning of the text) or negative (starting from the end)
The second string will be found only after the first one.
Both string can be included or excluded with boolean parameters.
e.g : BetweenNext ( "A 1234567890 X B 1234567890 X C 1234567890 X" ; "B" ; 1 ; 1 ; "X" ; 1 ; 0 )
= "B 1234567890 "
see also Between, Before and After functions
*/
Let ([
_occurrence1 = Case ( occurrence1 = 0 ; 1 ; occurrence1 )
; _occurrence2 = Case ( occurrence2 = 0 ; 1 ; occurrence2 )
; _start = Position ( text ; searchString1 ; Case ( _occurrence1 < 0 ; Length ( text ) ; 1 ) ; _occurrence1 )
; _rightText = Replace ( text ; 1 ; _start + Length ( searchstring1 ) -1 ; "" )
; _end = Position ( _rightText ; searchString2 ; Case ( _occurrence2 < 0 ; Length ( _rightText ) ; 1 ) ; _occurrence2 ) + Length ( searchstring2 ) -1
; _result = Case ( include1_1 ; searchstring1 ) & Left ( _rightText ; _end - Case ( not include2_1 ; Length ( searchstring2 )))
]
;
Case ( _start and _end ; _result )
)
Note: these functions are not guaranteed
or supported by BrianDunning.com. Please contact the individual
developer with any questions or problems.
Easily encrypt sensitive data in your FileMaker solution without a plug-in. Click
here.
Custom Function Authors:
Link to all of your own custom functions on this site with the following URL:
http://www.briandunning.com/filemaker-custom-functions/results.php?author=Your
Name Here