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.
NFAPossessive Quantifierbacktracking
0 likes · 13 min read