Brian Dunning's FileMaker Custom Functions

text.after ( _text ; _searchString ; _occurrence ; _include.b )

extracts text after search string

  Average rating: 4.2 (35 votes) Log in to vote

Fabrice Nordmann   Fabrice Nordmann - Show more from this author
1-more-thing
https://www.1-more-thing.com

Share on Facebook Share on Twitter

  Sample input:
After ("jim@aol.com" ; "@" ; 1 ; 0)
After ("aa:bb:cc" ; ":" ; -1 ; 1 )
After ("¶a¶b" ; ¶ ; 1 ; 0)
  Sample output:
aol.com

:cc

a¶b

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

extracts the end of a text, based on a search string and an occurrence number
occurrence can be positive (starting from the beginning of the text) or negative (starting from the end)

e.g. text.after ( "1234512345" ; "2" ; -1 ; 0 ) = "345"

see also text.before, text.between, and text.betweenNext functions

 

Comments

David Owen   David Owen, Bloomfield, CT, USA
Jul 2, 2009
Examples need to add the include_1 parameter, which I learned to use a zero for after looking at the After custom function
 
Jaap Lips   Jaap Lips, Oud-Beijerland
Aug 17, 2017
Hi Fabrice,

I use your function. But what happens if the searchstring does not exist in the text?
 
Fabrice Nordmann   Fabrice Nordmann, 1-more-thing
Sep 2, 2017
Hi Jaap,
you're correct. I updated it here so it returns empty.

Fabrice
 
Jaap Lips   Jaap Lips, Oud-Beijerland
Sep 5, 2017
Hi Fabrice,

It works great now!
Thank you!
 

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