If Input Contains
Learn how to use the If Input Contains node to create conditional logic based on input content patterns.
The If Input Contains node allows you to create dynamic paths in your workflow by checking if inputs contain specific text patterns or match regex expressions. The node evaluates conditions using OR logic, executing the path if any condition is met.
Functionality
The If Input Contains node acts as a content filter, analyzing input text and directing the flow based on pattern matching. This can be useful for:
- Content Filtering: Route inputs containing specific keywords or patterns
- Safety Checks: Identify and handle inputs with particular content
- Dynamic Routing: Create different processing paths based on input content
- Pattern Recognition: Use regex to identify complex text patterns
Node Properties
For each condition you add, you can configure:
- Text to Match: The pattern or text to search for in the input
- Use Regex: Toggle to enable regular expression pattern matching
- Case Sensitive: Toggle to make the pattern matching case sensitive
Multiple conditions are evaluated using OR logic — if any condition is true, the workflow will proceed down the true path. To use AND logic, simply chain multiple If Input Contains nodes together.
Usage Examples
Scenario: Content-Based Routing
Let’s say you want to handle inputs differently based on whether they contain questions about specific topics:
- Add an If Input Contains node to your workflow
- Add conditions for different keywords:
- Text: “pricing” (for pricing-related queries)
- Text: “support” (for support-related queries)
- Connect the “True” path to specialized handling nodes
- Connect the “False” path to general handling nodes
Scenario: Pattern Matching with Regex
To identify inputs containing email addresses or specific formats:
- Add an If Input Contains node
- Enable “Use regex”
- Add a condition with pattern:
[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}
- Route matching inputs to appropriate handling nodes
Tips and Best Practices
- Start with simple text matches before using regex for complex patterns
- Use case sensitivity thoughtfully — consider your use case requirements
- Combine multiple conditions to create more sophisticated routing logic
- Test your conditions with various input texts to ensure proper routing
- Consider checking the Execution Logs to track which conditions are being triggered