← Quiz: TOC Basics: all 10 questions
Quiz: TOC Basics · Question 5 of 10
Why can't a regular expression match arbitrarily deeply nested brackets?
Why can't a regular expression match arbitrarily deeply nested brackets?
- A.Regex engines are too slow
- B.Nested brackets form a context-free (not regular) language; finite automata have no memory to count depth
- C.Brackets are special characters
- D.It can, with enough backslashes
Answer & explanation
Correct answer: Nested brackets form a context-free (not regular) language; finite automata have no memory to count depth
Matching nesting needs a stack — the power of a pushdown automaton.
Can you get the rest right without peeking?
Take the timed Quiz: TOC Basics quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →