Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
frontend ruleP1universalStack: typescript
htmlparsingregexcorrectness
Match HTML tags case-insensitively and with proper boundaries
Detect HTML elements with a case-insensitive, boundary-aware regex rather than a naive substring includes that misses uppercase and matches lookalike tags.
PR: hegnar-components · org-mining-deep-2026-06Created: Jun 17, 2026
Bad example
Old codetypescript
| 1 | if (html.includes('<table')) { /* misses <TABLE>, matches <datatable> */ } |
Explanation (EN)
Objašnjenje (HR)
Good example
New codetypescript
| 1 | if (/<table[\s>]/i.test(html || '')) { /* case-insensitive, boundary-aware */ } |
Explanation (EN)
Objašnjenje (HR)