Brian Dunning's FileMaker Custom Functions

Grep ( pattern ; text )

Perform simple matching of text lines, similar to the traditional grep tool.

  Be the first to rate this function Log in to vote

Chris Irvine   Chris Irvine - Show more from this author LLC

Share on Facebook Share on Twitter

  Sample input:
Grep ( "Ipsum" ; $large_text )
  Sample output:
Lorem ipsum dolor sit amet,
ipsum cursus elementum.

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

Assuming you have a block of text, you may only be interested in processing lines which contain a certain value or phrase, ignoring other lines.

Use the grep function to filter only those relevant lines into a new string. The entire line is retained if the pattern is found anywhere in that line.

Function uses while() instead of recursion, which should support almost any amount of text, though you might need to utilize SetRecursion(). As a result, this function requires v18.0 or higher.



belg4mit   belg4mit
Aug 3, 2022
See FilterList for a generalized function that also covers grep -i and -v, etc.

Log in to post comments.


Note: these functions are not guaranteed or supported by 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 18 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: