Lola Text Match icon

Lola Text Match

Lola Phone Number Validation

Overview

The Lola Text Match node is designed to compare an input text against a target value or list, supporting both strict and fuzzy matching operations. It can be used to determine if a given string matches (exactly or approximately) any item in a provided list or a single target string. This node is useful for scenarios such as:

  • Validating user input against a whitelist or blacklist.
  • Deduplicating records by checking for similar entries.
  • Implementing search or suggestion features based on approximate string matching.

Practical examples:

  • Checking if an email address exists in a list of registered users.
  • Finding the closest match for a product name in an inventory.
  • Matching phone numbers with or without formatting differences.

Properties

Name Meaning
Input Text Text to match with lists. The main input string to be compared.
Trim Input Text Whether to trim input text. If enabled, leading/trailing whitespace will be removed from the input before matching.
Target Array Whether to use a target array instead of a single string. Enables comparison against a list rather than a single value.
Target String Target string to match with input text. Used when "Target Array" is disabled.
Target Object Array Target list to match with input text. Used when "Target Array" is enabled; expects a JSON array.
Specify List Item Property Whether to specify a property of the list item to match with input text. When enabled, compares the input text to a specific property of each object in the array.
Item Property Name Name of the property of the list item to match with input text. Only relevant if "Specify List Item Property" is enabled.
Operation Type of comparison to perform:
- Strict Match - Sensitive
- Strict Match - Non Sensitive
- Fuzzy Best Match
- Fuzzy Treshold Match
Fuzzy Treshold Fuzzy threshold to use in fuzzy threshold match. Only required when "Operation" is set to "Fuzzy Treshold Match".

Output

The node outputs two branches: one for matches ("match") and one for misses ("miss"). Each output item contains a lola_text_match field in its json property with the following structure:

{
  "isMatched": true,           // Boolean indicating if a match was found
  "matchedItem": {},           // The matched item from the list (if applicable)
  "bestFuzzyMatch": {},        // Details about the best fuzzy match (if applicable)
  "fuzzyMatchs": []            // Array of all fuzzy match results (if applicable)
}
  • isMatched: true if a match was found according to the selected operation.
  • matchedItem: The exact item from the list that matched (for strict matches).
  • bestFuzzyMatch: The best match result from fuzzy matching (object with details like score and item).
  • fuzzyMatchs: An array of all fuzzy match results (each with score and item).

If no match is found, these fields may be null or empty.

Dependencies

  • External Library: Uses the fast-fuzzy package for fuzzy matching logic.
  • n8n Configuration: No special API keys or environment variables are required.

Troubleshooting

Common Issues:

  • Incorrect Input Types: Supplying a non-array value to "Target Object Array" or invalid JSON will cause errors.
  • Missing Required Fields: Not providing required properties (e.g., "Item Property Name" when needed) will prevent the node from running.
  • Unsupported Operations: Attempting to use fuzzy matching operations with a single string target will throw an error.

Error Messages:

  • "Fuzzy Best Match is not supported for single string comparison"
    Resolution: Use "Target Array" mode for fuzzy matching.
  • "Fuzzy Treshold Match is not supported for single string comparison"
    Resolution: Use "Target Array" mode for fuzzy threshold matching.

Links and References

Discussion