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  (41 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.


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 2 + 3 =
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. SortList ( theList )
  (Sat, Jun 23, 8:45am)
2. HexUUIDToNum_cf (_uuid)
  (Sat, Jun 16, 1:55pm)
3. httpResponseCode ( responseHeaders )
  (Tue, Jun 12, 10:40pm)
4. FindDuplicateCharacters ( string )
  (Fri, Jun 08, 5:01pm)
5. FieldRepetitionLast ( field ; maxRepetition )
  (Wed, Jun 06, 6:05pm)
6. CountModifiedRecords ( NameTimestampField ; StartTimestamp ; EndTimestamp )
  (Mon, May 28, 8:23am)
7. JSONArrayLength ( JSONArrayStr )
  (Fri, May 25, 7:46am)
8. interpolation (y1; y2; y3; x1; x2; x3; x1y1; x2y1; x1y2; x2y2; rnd)
  (Sat, May 19, 3:55am)

RSS Feed of Custom Functions