Lines Matching refs:regular
18 This document is an introductory tutorial to using regular expressions in Python
42 The regular expression language is relatively small and restricted, so not all
43 possible string processing tasks can be done using regular expressions. There
44 are also tasks that *can* be done with regular expressions, but the expressions
47 elaborate regular expression, it will also probably be more understandable.
53 We'll start by learning about the simplest possible regular expressions. Since
54 regular expressions are used to operate on strings, we'll begin with the most
57 For a detailed explanation of the computer science underlying regular
66 regular expression ``test`` will match the string ``test`` exactly. (You can
121 :const:`re.ASCII` flag when compiling the regular expression.
165 Being able to match varying sets of characters is the first thing regular
258 Now that we've looked at some simple regular expressions, how do we actually use
259 them in Python? The :mod:`re` module provides an interface to the regular
283 because regular expressions aren't part of the core Python language, and no
298 As stated earlier, regular expressions use the backslash character (``'\'``) to
322 string, because the regular expression must be ``\\``, and each backslash must
323 be expressed as ``\\`` inside a regular Python string literal. In REs that
327 The solution is to use Python's raw string notation for regular expressions;
333 In addition, special escape sequences that are valid in regular expressions,
354 Once you have an object representing a compiled regular expression, what do you
476 not recognized by Python, as opposed to regular expressions, now result in a
525 Compilation flags let you modify some aspects of how regular expressions work.
591 Setting the :const:`LOCALE` flag when compiling a regular expression will cause
638 This flag allows you to write regular expressions that are more readable by
674 So far we've only covered a part of the features of regular expressions. In
696 Alternation, or the "or" operator. If *A* and *B* are regular expressions,
761 First, this is the worst collision between Python's string literals and regular
799 This can be handled by writing a regular expression which matches an entire
880 problem. Both of them use a common syntax for regular expression extensions, so
883 Perl 5 is well known for its powerful additions to standard regular expressions.
885 or new special sequences beginning with ``\`` without making Perl's regular
888 a regular character and wouldn't have escaped it by writing ``\&`` or ``[&]``.
906 Sometimes you'll want to use a group to denote a part of a regular expression,
909 ``...`` with any other regular expression. ::
970 current point. The regular expression for finding doubled words,
985 Positive lookahead assertion. This succeeds if the contained regular
1009 extension. This regular expression matches ``foo.bar`` and
1092 Split *string* by the matches of the regular expression. If capturing
1226 you need to specify regular expression flags, you must either use a
1244 such as the :const:`~re.IGNORECASE` flag, then the full power of regular expressions
1248 more generalized regular expression engine.
1262 doing both tasks and will be faster than any regular expression operation can
1293 instead. The regular expression compiler does some analysis of REs in order to
1308 When repeating a regular expression, as in ``a*``, the resulting action is to
1324 match at the end of the string, so the regular expression engine has to
1338 (Note that parsing HTML or XML with regular expressions is painful.
1340 cases that will break the obvious regular expression; by the time you've written
1341 a regular expression that handles all of the possible cases, the patterns will
1348 By now you've probably noticed that regular expressions are a very compact
1353 For such REs, specifying the :const:`re.VERBOSE` flag when compiling the regular
1354 expression can be helpful, because it allows you to format the regular
1357 The ``re.VERBOSE`` flag has several effects. Whitespace in the regular
1387 The most complete book on regular expressions is almost certainly Jeffrey
1389 it exclusively concentrates on Perl and Java's flavours of regular expressions,