Tagged articles
2 articles
Page 1 of 1
Tencent Cloud Developer
Tencent Cloud Developer
Jun 19, 2018 · Backend Development

Understanding Catastrophic Backtracking in Java Regular Expressions and How to Fix It

During a production incident a Java service’s URL‑validation regex caused near‑100 % CPU due to catastrophic backtracking from a greedy domain pattern, which was fixed by adding missing characters to the final class and converting the domain part to a possessive or atomic quantifier, preventing exponential matching.

BacktrackingNFAjava
0 likes · 13 min read
Understanding Catastrophic Backtracking in Java Regular Expressions and How to Fix It
Alibaba Cloud Developer
Alibaba Cloud Developer
Aug 25, 2017 · Fundamentals

Avoid Catastrophic Backtracking: How Regex Can Crash Your Server

A detailed exploration of how a complex regular expression used for shop‑name validation caused CPU spikes due to catastrophic backtracking, explaining DFA vs NFA engines, greedy, lazy and possessive quantifiers, and offering practical tips to write performant regexes.

DFANFAcatastrophic backtracking
0 likes · 9 min read
Avoid Catastrophic Backtracking: How Regex Can Crash Your Server