When Regex Goes Wrong

September 11, 2024

Issues and catastrophic failures caused by regexIn 2016, Stack Overflow experienced a 34-minute outage. The root cause? A regular expression (Regex) used in a part of the code that handled user input.It took 10 minutes to pinpoint the issue, 14 minutes to write the fix, and another 10 minutes to deploy the solution and restore Stack Overflow’s availability.What caused the outage?^[\s\u200c]+|[\s\u200c]+$

Source: When Regex Goes Wrong

Regular expressions are (for most developers) like magic incantations. Powerful and arcane. This piece looks a some catastrophic consequences of their use and draws lessons from these incidents.