get_text_part_between_opener_and_closer ( text ; opener ; opener_occurrence ; closer ; error_indicator )
Extracts the part of text between opener ( that is opener's opener_occurrence ) and the first closer after closer.
Be the first to rate this function Log in to vote
Frank van der Most - Show more from this author
Rubber Boots Data https://rubberbootsdata.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
From text, gets the part between the opener_occurrence occurrence of opener and the first of occurrence of closer after opener
If IsEmpty ( closer ) then the result is everything after the opener_occurrence occurrence of opener
If IsEmpty ( opener ) then the result is everything before the closer
Since the text parameter can contain any text, it is hard to come up with a universal error indicator. Hence the error_indicator parameter.
Perhaps similar functions already exist in the database. I could only find ExtractPortion, which seems too simple.
I wrote this function to retrieve text from a URL but there are of course plenty of applications.
I have tested the function somewhat, but perhaps there are situations that would slip past the safety test.
My only regret with this function is that FM's position function is not case sensitive. Fortunately, there are solutions for that in this database.
If you release the comment with test parameters, you can run the function also in the data viewer or use it directly in a calculation.
Comments
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.