I'm having some difficulty extracting selected text from a text field and put it into it's own field. So for example, I have a paragraph of text and I need to be able to search for a phrase. Melting Point: 50C. So I figured to first search for the word melting and end with the first C that it finds and everything between.
I tried the custom function below from http://www.briandunning.com/cf/644.
Between ( text ; searchString1 ; occurrence1 ; include1_1 ; searchString2 ; occurrence2 ; include2_1)
by Fabrice Nordmann
v.2, Mar 2007
v.1, Jan 2007
v.2 adds inclusion boolean parameters
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)
see also Before After, and BetweenNext functions
_occurrence1 = Case ( occurrence1 = 0 ; 1 ; occurrence1 )
; _occurrence2 = Case ( occurrence2 = 0 ; 1 ; occurrence2 )
; _p1= Position ( text ; searchString1 ; Case ( _occurrence1 < 0 ; Length ( text ) ; 1 ) ; _occurrence1 ) + not GetAsBoolean ( include1_1 ) * Length ( searchString1 )
; _p2= Position ( text ; searchString2 ; Case ( _occurrence2 < 0 ; Length ( text ) ; 1 ) ; _occurrence2 ) + GetAsBoolean ( include2_1 ) * Length ( searchString2 )
Middle ( text ; _p1 ; _p2 - _p1 )