Purpose
The Regex Evaluator is particularly useful when you need to:- Validate text formats and patterns
- Check for specific text structures
- Verify data formats (emails, phone numbers, etc.)
- Ensure responses follow a particular pattern
- Test for specific text content requirements
How It Works
The evaluator uses a binary scoring system based on regex pattern matching:- Score: 1: The response matches the specified regex pattern
- Score: 0: The response does not match the specified regex pattern
re.search()
function to check if the response contains any substring that matches the provided regex pattern.
Usage Example
- A binary score (0 or 1) indicating pattern match status
- A list of explanations including:
- Success message with the pattern if matched
- Failure message with the pattern if not matched
When to Use
Use the Regex Evaluator when you need to:- Validate email addresses
- Check phone number formats
- Verify date formats
- Ensure specific text patterns
- Test URL formats
- Validate structured data formats
- Check for specific text content
- Verify code snippets or commands