GetTextBetween ( text ; from ; to ; occurrence )
Gets the text between the nth "occurence" of string "from" and string "to"
Average rating: 4.0 (39 votes) Log in to vote
Ulf Carlsson - Show more from this author
Studentlitteratur AB http://www.studentlitteratur.se |
Function definition: (Copy & paste into FileMaker'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:
.....
Actor:
Joaquin Phoenix
Djimon Hounsou
Connie Nielsen
Richard Harris
Derek Jacobi
Oliver Reed
....
GetTextBetween ( pageAbove ; "movies,,,\">", "", 5) = "Richard Harris"
GetTextBetween ( pageAbove ; "movies,,,\">", "", 3) = "Djimon Hounsou"
Comments
Bill S, NY Jun 9, 2014 |
||
I tried to parse the following HTML in order to get what is between the frist </ul> and the third <h2>. Unfortunatly i get the right result short of the closing ul tag. Do you know what i might be doing wrong? <h2>Milwaukee 48-59-1812 Features</h2> <ul><li>Charger compatible with M12 battery packs: 48-11-2401, 48-11-2402</li></ul> <h2>Milwaukee 48-59-1812 Specifications</h2> <ul><li>Model: 48-59-1812</li></ul> <h2>Milwaukee 48-59-1812 Includes</h2> <ul><li>(1) M18 and M12 Li-Ion Battery Charger</li></ul> Any help would be greatly appreciated? |
||
unix, Japan Nov 11, 2014 |
||
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. |
||
Rich, Wales Jun 26, 2015 |
||
Thanks for this, saved my a lot of effort | ||
Ulf Carlsson, Lund Jun 29, 2015 |
||
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 Jun 29, 2015 |
||
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 |
||
Bert Duivestein, Zwolle Aug 28, 2017 |
||
Thanks! Works great to derive tags from a XML file. | ||
Binu Alexander, ASC, Aug 20, 2020 |
||
This is a great ! saved hours of my time. | ||
Kevin B Aug 18, 2022 |
||
How would I extract values where quotation marks are used in the search text? | ||
Kevin B Aug 18, 2022 |
||
How would I extract values where quotation marks are used in the search text? | ||
Kevin B Aug 18, 2022 |
||
Sorry...I figured it out with a "Substitute" function... | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.
Support this website.
This library has been a free commmunity resource for FileMaker users and developers for 21 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:
Support this website.
This library has been a free commmunity resource for FileMaker users and developers for 21 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: