mirror of
https://github.com/python/cpython.git
synced 2025-11-02 11:08:57 +00:00
Remove extra indenatation from sample interpreter session.
Remove whitespace from the middle of an inline RE example; it was OK for the typeset formats, but LaTeX2HTML is more touchy about this.
This commit is contained in:
parent
dfd0b296d7
commit
9479c958c5
1 changed files with 11 additions and 11 deletions
|
|
@ -857,17 +857,17 @@ of backtracking, you may encounter a RuntimeError exception with the message
|
|||
\code{maximum recursion limit exceeded}. For example,
|
||||
|
||||
\begin{verbatim}
|
||||
>>> s = "<" + "that's a very big string!"*1000 + ">"
|
||||
>>> re.match('<.*?>', s)
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in ?
|
||||
File "/usr/local/lib/python2.3/sre.py", line 132, in match
|
||||
return _compile(pattern, flags).match(string)
|
||||
RuntimeError: maximum recursion limit exceeded
|
||||
>>> s = "<" + "that's a very big string!"*1000 + ">"
|
||||
>>> re.match('<.*?>', s)
|
||||
Traceback (most recent call last):
|
||||
File "<stdin>", line 1, in ?
|
||||
File "/usr/local/lib/python2.3/sre.py", line 132, in match
|
||||
return _compile(pattern, flags).match(string)
|
||||
RuntimeError: maximum recursion limit exceeded
|
||||
\end{verbatim}
|
||||
|
||||
You can often restructure your regular expression to avoid backtracking.
|
||||
The above regular expression can be recast as \regexp{\textless
|
||||
[\textasciicircum \textgreater]*\textgreater}. As a further
|
||||
benefit, such regular expressions will run faster than their backtracking
|
||||
equivalents.
|
||||
The above regular expression can be recast as
|
||||
\regexp{\textless[\textasciicircum \textgreater]*\textgreater}. As a
|
||||
further benefit, such regular expressions will run faster than their
|
||||
backtracking equivalents.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue