79389353

Date: 2025-01-26 21:54:59
Score: 0.5
Natty:
Report link

Your 6th item in directive causes Catastrophic backtracking
# Annotatable definition attributes
resulting in TextMate giving up on the rest of the line

regex101.com

\b((?:\s*(?!class|enum|interface|type|namespace|var|const|function|extends|implements|default\s+xml\s+namespace|new|delete|void|typeof|await|yield|instanceof|not\s+in|in|is(\s+not)?|as|if|else|for\s+each|for|return|throw|switch\s+type|switch|case|try|catch|finally\b)(?:[\p{L}$_\p{Nl}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))(?:[\p{L}$_\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))*(?:\s*\.\s*(?:[\p{L}$_\p{Nl}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))(?:[\p{L}$_\p{Nl}\p{Mn}\p{Mc}\p{Nd}\p{Pc}]|\\u((\{[A-Fa-f0-9]+\})|[A-Fa-f0-9]{4}))*)*)+)\s*(?=class|enum|interface|type|namespace|var|const|function)\b

VSCode JSON TextMate

I would recommend using atomic groups (?>...) and possessive quantifiers ?+, *+ & ++ where possible
This will disable backtracking
Just remember it can be a double edge sword if you've set up your regex in a way that requires backtracking for it to work

Reasons:
  • Probably link only (1):
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: RedCMD