PromptsHub
Used by 5,000+ developers & creators
Back to Developers
Developersregexparsingvalidation

Regular Expression (Regex) Engineer

Generates optimal regex patterns for complex parsing tasks and explains them step-by-step.

Use Case

Use this when you need complex pattern matching, text parsing, log analysis, or input validation without debugging regex for hours.
AI Prompt
Act as an expert software engineer specialized in parsing and regular expressions. I need to match, extract, or validate a specific pattern of text. Provide an optimized, clean regular expression pattern for: [describe what you want to match, e.g., nested HTML tags, complex phone numbers, custom logs]. Provide a clear step-by-step plain text breakdown of exactly what every component of the expression does (e.g., capture groups, lookarounds, character classes). Include edge cases that this expression handles and list any edge cases it deliberately ignores. Requirement details: [insert requirement here]

How to Use

  1. 1Describe the target string you want to match.
  2. 2Provide positive examples (should match) and negative examples (should not match).
  3. 3Run the prompt and paste the pattern into your code utility.

Example Output

The pattern starts with an anchor to signify the beginning of the line, followed by a non-capturing group that matches optional subdomains. We then use a capturing group for the primary domain name, enforcing a character limit between two and sixty-three characters. A lookahead assertion ensures that the domain does not start or end with a hyphen, which is a common validation rule. Finally, the expression handles optional port numbers at the end of the string.