Jira Issue Key Regex -
test-1 (lowercase prefix), -1 (no prefix), PROJ--123 (multiple hyphens), PROJ- (no number). 3. The Canonical Regular Expression After reviewing community standards (e.g., from Atlassian SDKs, git commit-msg hooks, and Semgrep rules), the most widely accepted regex is:
| Edge Case | Example | Simple Regex | Correct Handling | |-----------|---------|--------------|------------------| | Lowercase letters | bug-42 | ❌ No match | Reject (invalid per spec) | | Digits in project | 123-456 | ❌ No match | Reject | | Leading zeros | PROJ-001 | ✅ Matches | Accept (valid in Jira) | | Multiple hyphens | PROJ-123-fix | ❌ Partial match ( PROJ-123 ) | Accept only first key, ignore suffix | | Adjacent text | Fix for PROJ-123 now | ✅ With \b works | Accept | | Adjacent underscore | PROJ-123_attachment | ⚠️ \b fails (underscore is word char) | Use negative lookbehind/lookahead | The word boundary \b treats underscores as word characters. Thus, PROJ-123_abc matches PROJ-123 incorrectly. Solution: jira issue key regex
\b[A-Z]+-[0-9]+\b The simple regex above fails or behaves ambiguously in several real-world scenarios: Thus, PROJ-123_abc matches PROJ-123 incorrectly