What is the complexity of regular expression?
问题 What is the complexity with respect to the string length that takes to perform a regular expression comparison on a string? 回答1: The answer depends on what exactly you mean by "regular expressions." Classic regexes can be compiled into Deterministic Finite Automata that can match a string of length N in O(N) time. Certain extensions to the regex language change that for the worse. You may find the following document of interest: Regular Expression Matching Can Be Simple And Fast. 回答2: