Brian Dunning's FileMaker Custom Functions

BetweenOpenCloseTag ( Txt ; OpenTag ; CloseTag ; n )

to extract between 2 tags even if the tag is repeated and nested - not recursive

  Average rating: 4.5 (27 votes) Log in to vote

Agnes Barouh   Agnes Barouh - Show more from this author
Tic Tac
http://www.tictac.fr/CoinFileMaker/Page.html

Share on Facebook Share on Twitter

  Sample input:
//---------------------------------- 1


BetweenOpenCloseTag ( "
Compositeur

Acteur
Ok

role

Test_Ok

Test
" ;
""; ""; 3 )


//---------------------------------- 2

BetweenOpenCloseTag (
"( Extract ( between ( 2 tags ) matches ) [ together ] )" ;
"("; ")"; 2 )
  Sample output:
//---------------------------------- Result



" Acteur

Ok

role"









//---------------------------------- Result

"between ( 2 tags ) matches"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

BetweenOpenCloseTag ( Txt ; OpenTag ; CloseTag ; n ) v2

** 052015 - Add -P+3 variable Ex
** 050715 - Suppress +1 variable Pos ( thanks Menno ! )
//
// to extract between 2 tags even if the tag is repeated and nested
// the closing tag matches the opening tag
// BetweenOpenCloseTag is not recursive function
/*
//---------------------------------- Parameter
• Txt : Text for extract
• OpenTag : Extract after open tag
• CloseTag : Extract before close Tag
• n : Target Occurrence
//---------------------------------- Example
With Txt =
"

Compositeur

Acteur

Ok

role

Test_Ok

Test




bonus


editeur


Actrice

et
Joueur


( et ceci ( was ok ( également ) with des ) parenthèses [ ou des crochets ] )"

- BetweenOpenCloseTag ( Txt ; ""; ""; 3 )
> Result :
" Acteur

Ok

role"

- BetweenOpenCloseTag ( Txt ; "("; ")"; 2 )
> Result : "was ok ( également ) with des"
*/
//————————--—---------------------——————-————
// @ Agnès - May 2015- BugReport
// Substitute ( filemaker§tictac.fr ; § ; @ )
//—————---------------------———————-———-————-

 

Comments

Eduardo Lemos   Eduardo Lemos, Victoria, Canada /Sao Paulo, Brazil
Dec 28, 2015
te chéris vraiment quelle élégance vous concevez vos fonctions, Agnès;
they are truly case studies.
thanks for sharing them.
 

Log in to post comments.

 

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 15 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: