Software Venture Consulting

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

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


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:  

RatingRatingRatingRatingRating
  Average rating: 4.1  (39 votes)
  Discuss this Custom Function

Ulf Carlsson, Studentlitteratur AB
http://www.studentlitteratur.se

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

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


 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

Description:

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 BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

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

Hello!

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

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?

Regards
Ulf

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:
City/Location:
Comment:
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 + 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. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions