Describe what you want to match in plain English, get a regex with breakdown and test cases.

Prompt

Create a regular expression for the following requirement:

[DESCRIBE WHAT YOU WANT TO MATCH]

Provide:
1. The regex pattern
2. Explanation of each part
3. Test cases (5 matches, 5 non-matches)
4. Common edge cases to consider

Example

Input:

Match valid email addresses

Output:

Pattern: ^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Explanation:
- ^                    Start of string
- [a-zA-Z0-9._%+-]+   One or more valid local part characters
- @                    Literal @ symbol
- [a-zA-Z0-9.-]+      Domain name
- \.                   Literal dot
- [a-zA-Z]{2,}        TLD (minimum 2 letters)
- $                    End of string

Matches:
- user@example.com
- john.doe@company.co.uk
- test+tag@gmail.com

Non-matches:
- @example.com
- user@.com
- user@com