PatternCount(): searching and counting occurrences in FileMaker
BeginnerPatternCount() counts how many times a substring appears in a text value. Learn how to use it for existence checks, occurrence counting, and basic text analysis.
What you'll learn
- How PatternCount counts occurrences of a substring
- How to use PatternCount as a boolean existence check
- Practical uses: validating email format, counting delimiters, checking for keywords
PatternCount ( text ; searchString ) returns the number of times searchString appears in text — returning 0 if not found and a positive integer for each occurrence found, making it ideal for both existence checks and counting.
1/2
1
Check whether a value contains a substring
PatternCount returns 0 if the substring is not found, so using it in an If condition acts as a boolean "contains" check. It is case-insensitive.
FileMaker Script
# Check if an email address contains @ If [ not PatternCount ( Contacts::email ; "@" ) ] Show Custom Dialog [ "Please enter a valid email address." ] Exit Script [ Result: False ] End If # Check if a text field contains a keyword If [ PatternCount ( Notes::body ; "urgent" ) ] Set Field [ Notes::flagged ; 1 ] End If
Text parsing in FileMaker: Left, Right, Middle, and PositionDate functions in FileMaker: Date, Day, Month, Year, DayName, DayOfYear
Sign in to track your progress and pick up where you left off.
Sign in to FM Dojo