Read more

Regular Expressions: Excessive backtracking can get yourself in trouble

Michael Leimstädtner
July 14, 2019Software engineer at makandra GmbH

Two weeks ago, Cloudflare was struck by a global outage that lasted ~30 minutes. The incident was rooted on a CPU exhaustion caused by a single regular expression containing some catastrophic backtracking Show archive.org snapshot :

.*(?:.*=.*)
Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show archive.org snapshot

This is a small reminder do keep using the lazy operator ? whenever possible and furthermore be aware that regular expressions should not only be unit-tested but also evaluated in terms of performance. See https://makandracards.com/makandra/494822-regular-expressions-quantifier-modes for more details.

Posted by Michael Leimstädtner to makandra dev (2019-07-14 10:15)