Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages

Shopping Cart
Shopping Cart


Free Newsletter


Privacy Policy

FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.


 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

GetTextBetween ( text ; from ; to ; occurrence )

Rate this function:  

  Average rating: 4.0  (40 votes)
  Discuss this Custom Function

Ulf Carlsson, Studentlitteratur AB

Gets the text between the nth "occurence" of string "from" and string "to"

Sample Input:
GetTextBetween ( "abcdxfghdefg hfd", "d", "f", 2 )
Sample Output:

 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed


Problem: You want to parse a html-file to extract some information
Solution: Use GetTextBetween!
A more advanced example:

Extract from a html-page:
<span class="GREY"><b>Actor:</b></SPAN>&nbsp;</TD>
<TD><A HREF="ds.php?red=ds_person.php&&arg=id@@@602,,,lang@@@se,,,subsite@@@movies,,,">Russell Crowe</A><BR><A HREF="ds.php?red=ds_person.php&&arg=id@@@603,,,lang@@@se,,,subsite@@@movies,,,">Joaquin Phoenix</A><BR><A HREF="ds.php?red=ds_person.php&&arg=id@@@604,,,lang@@@se,,,subsite@@@movies,,,">Djimon Hounsou</A><BR><A HREF="ds.php?red=ds_person.php&&arg=id@@@605,,,lang@@@se,,,subsite@@@movies,,,">Connie Nielsen</A><BR><A HREF="ds.php?red=ds_person.php&&arg=id@@@606,,,lang@@@se,,,subsite@@@movies,,,">Richard Harris</A><BR><A HREF="ds.php?red=ds_person.php&&arg=id@@@607,,,lang@@@se,,,subsite@@@movies,,,">Derek Jacobi</A><BR><A HREF="ds.php?red=ds_person.php&&arg=id@@@608,,,lang@@@se,,,subsite@@@movies,,,">Oliver Reed</A>

GetTextBetween ( pageAbove ; "movies,,,\">", "</A>", 5) = "Richard Harris"
GetTextBetween ( pageAbove ; "movies,,,\">", "</A>", 3) = "Djimon Hounsou"

Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it


5 most recent comments | Show all 6 comments

There is only one occurrence parameter, it is used for starting position.
So you can't use as 'the third <h2>'.
Add one more parameter to specify ending position, or change the place between 2 Position function.

unix, Japan
November 11, 2014 7:25pm

Thanks for this, saved my a lot of effort

Rich, Wales
June 26, 2015 3:01am


Remember that you can use more characters to get unique start and stop places. I would try having "</li></ul>
<h2>" as stop point.

best regards,

Ulf Carlsson, Lund
June 29, 2015 12:03am

Hello again!

I have also in some cases first found the text i wanted by first finding a bigger surrounding text, when i got that, it was easier to find the text I wanted inside the fist text. Perhaps you can use that method?


Ulf Carlsson, Lund
June 29, 2015 12:06am

Thanks! Works great to derive tags from a XML file.

Bert Duivestein, Zwolle
August 28, 2017 2:53am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 6 + 2 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. PreviousMonthEndDate ( myDate )
  (Wed, Mar 07, 3:35am)
2. PreviousMonthName (myDate)
  (Wed, Mar 07, 3:33am)
3. FmTableFields ( tableName ; fieldsInclude ; fieldsExclude ; classExclude ; typeExclude ; prefixExclude )
  (Fri, Mar 02, 6:32am)
4. sql.getTable ( fullyQualifiedFieldObject )
  (Thu, Feb 22, 8:36am)
5. sql.getField ( fullyQualifiedFieldObject )
  (Thu, Feb 22, 8:34am)
6. FilterOut ( ListA ; ListB )
  (Wed, Feb 21, 6:11pm)
7. Char0 ( )
  (Sun, Feb 18, 2:35am)
8. CreateVCardFile ( FirstName ; LastName ; CompanyName ; Phone ; Email ; WEB ; hAddress1 ; hAddress2 ; hZip ; hCity ; hCountry ; wAddress1 ; wAddress2 ; wZip ; wCity%2
  (Sun, Feb 18, 1:50am)

RSS Feed of Custom Functions