regarding regex (specifically python re), if we ignore the way the expression is written, is the length of the text the only factor for the time required to process the document? Or are there other factors (like how the text is structured) that play important roles too?
regarding regex (specifically python re), if we ignore the way the expression is written,
Share
Both the length of the text and its contents are important.
As an example the regular expression
a+bwill fail to match quickly on a string containing one millionbs but more slowly on a string containing one millionas. This is because more backtracking will be required in the second case.Results: