/** * Regular expression patterns for parsing markdown task syntax * * All patterns are documented with examples and test cases. */ /** * Matches GitHub Flavored Markdown task checkbox syntax * * Examples: * "- [ ] Task" → match, incomplete * "- [x] Task" → match, complete * " - [X] Task" → match, complete (case-insensitive) * "* [ ] Task" → no match (only dash lists supported) * * Groups: * [1] - Leading whitespace (indentation) * [2] - Checkbox state: space (incomplete) or x/X (complete) */ export const TASK_CHECKBOX = /^(\s*)-\s+\[([ xX])\]\s+/; /** * Matches assignee mentions (@username) * * Examples: * "@nick" → "nick" * "@jane-doe" → "jane-doe" * "@alex_chen" → no match (underscores not supported) * * Groups: * [1] - Username (alphanumeric and hyphens only) */ export const ASSIGNEE = /@([\w-]+)/; /** * Matches urgent priority marker (triple exclamation) * * Examples: * "Task !!!" → match * "Task !!" → no match */ export const PRIORITY_URGENT = /!!!/; /** * Matches high priority marker (double exclamation) * * Examples: * "Task !!" → match * "Task !!!" → no match (would match urgent first) */ export const PRIORITY_HIGH = /!!/; /** * Matches normal priority marker (single exclamation, not part of !! or !!!) * * Examples: * "Task !" → match * "Task !!" → no match * "Task !!!" → no match * * Uses negative lookbehind and lookahead to ensure single ! */ export const PRIORITY_NORMAL = /(?