🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Regular Expressions: all 10 questions

Quiz: Regular Expressions · Question 5 of 10

Why should you avoid patterns like (a+)+$ on user input?

Why should you avoid patterns like (a+)+$ on user input?

  1. A.They are not valid regex
  2. B.Backtracking engines can take exponential time on them (ReDoS)
  3. C.They only match numbers
  4. D.They are context-free
Answer & explanation

Correct answer: Backtracking engines can take exponential time on them (ReDoS)

Nested quantifiers cause catastrophic backtracking on near-matching input.

Can you get the rest right without peeking?

Take the timed Quiz: Regular Expressions quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →