© Zsolt Nagy 2018
Zsolt NagyRegex Quick Syntax Referencehttps://doi.org/10.1007/978-1-4842-3876-9_10

10. Optimizing Regular Expressions

Zsolt Nagy1 
Berlin, Germany

You have learned all the tools to optimize the execution of a regular expression; therefore, this chapter acts as a summary for everything you have learned so far.

You learned that the execution of regexes can be modeled using two types of automata: deterministic and nondeterministic FSM.

The execution time of a nondeterministic automaton can be exponentially measured in the number of its steps. The complexity comes from the need for backtracking.

Creating a deterministic finite state automaton from a nondeterministic automaton also has exponential complexity.

In most execution environments, ...

Get Regex Quick Syntax Reference: Understanding and Using Regular Expressions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.