Lines Matching refs:regular
14 This module provides regular expression matching operations similar to
29 string, because the regular expression must be ``\\``, and each
30 backslash must be expressed as ``\\`` inside a regular Python string
33 The solution is to use Python's raw string notation for regular expression
40 It is important to note that most regular expression operations are available as
42 :ref:`compiled regular expressions <re-objects>`. The functions are shortcuts
58 A regular expression (or RE) specifies a set of strings that matches it; the
60 regular expression (or if a given regular expression matches a particular
63 Regular expressions can be concatenated to form new regular expressions; if *A*
64 and *B* are both regular expressions, then *AB* is also a regular expression.
70 and implementation of regular expressions, consult the Friedl book [Frie09]_,
73 A brief explanation of the format of regular expressions follows. For further
77 ordinary characters, like ``'A'``, ``'a'``, or ``'0'``, are the simplest regular
85 how the regular expressions around them are interpreted.
96 .. index:: single: . (dot); in regular expressions
103 .. index:: single: ^ (caret); in regular expressions
109 .. index:: single: $ (dollar); in regular expressions
114 matches both 'foo' and 'foobar', while the regular expression ``foo$`` matches
120 .. index:: single: * (asterisk); in regular expressions
127 .. index:: single: + (plus); in regular expressions
134 .. index:: single: ? (question mark); in regular expressions
141 single: *?; in regular expressions
142 single: +?; in regular expressions
143 single: ??; in regular expressions
155 single: {} (curly brackets); in regular expressions
178 .. index:: single: \ (backslash); in regular expressions
194 single: [] (square brackets); in regular expressions
202 .. index:: single: - (minus); in regular expressions
215 .. index:: single: \ (backslash); in regular expressions
221 .. index:: single: ^ (caret); in regular expressions
234 .. .. index:: single: --; in regular expressions
235 .. .. index:: single: &&; in regular expressions
236 .. .. index:: single: ~~; in regular expressions
237 .. .. index:: single: ||; in regular expressions
253 .. index:: single: | (vertical bar); in regular expressions
256 ``A|B``, where *A* and *B* can be arbitrary REs, creates a regular expression that
267 single: () (parentheses); in regular expressions
270 Matches whatever regular expression is inside the parentheses, and indicates the
276 .. index:: single: (?; in regular expressions
292 for the entire regular expression.
295 regular expression, instead of passing a *flag* argument to the
299 .. index:: single: (?:; in regular expressions
302 A non-capturing version of regular parentheses. Matches whatever regular
333 .. index:: single: (?P<; in regular expressions
336 Similar to regular parentheses, but the substring matched by the group is
339 regular expression. A symbolic group is also a numbered group, just as if
360 .. index:: single: (?P=; in regular expressions
366 .. index:: single: (?#; in regular expressions
371 .. index:: single: (?=; in regular expressions
378 .. index:: single: (?!; in regular expressions
385 .. index:: single: (?<=; in regular expressions
412 .. index:: single: (?<!; in regular expressions
435 .. index:: single: \ (backslash); in regular expressions
447 .. index:: single: \A; in regular expressions
452 .. index:: single: \b; in regular expressions
468 .. index:: single: \B; in regular expressions
479 .. index:: single: \d; in regular expressions
491 .. index:: single: \D; in regular expressions
498 .. index:: single: \s; in regular expressions
512 .. index:: single: \S; in regular expressions
519 .. index:: single: \w; in regular expressions
534 .. index:: single: \W; in regular expressions
543 .. index:: single: \Z; in regular expressions
549 single: \a; in regular expressions
550 single: \b; in regular expressions
551 single: \f; in regular expressions
552 single: \n; in regular expressions
553 single: \N; in regular expressions
554 single: \r; in regular expressions
555 single: \t; in regular expressions
556 single: \u; in regular expressions
557 single: \U; in regular expressions
558 single: \v; in regular expressions
559 single: \x; in regular expressions
560 single: \\; in regular expressions
563 accepted by the regular expression parser::
596 regular expressions. Most non-trivial applications always use the compiled
605 Compile a regular expression pattern into a :ref:`regular expression object
623 but using :func:`re.compile` and saving the resulting regular expression
631 programs that use only a few regular expressions at a time needn't worry
632 about compiling regular expressions.
691 Compiled regular expression objects with the :const:`re.LOCALE` flag no
719 .. index:: single: # (hash); in regular expressions
721 This flag allows you to write regular expressions that look nicer and are
730 This means that the two following regular expression objects that match a
743 Scan through *string* looking for the first location where the regular expression
752 If zero or more characters at the beginning of *string* match the regular
766 If the whole *string* matches the regular expression *pattern*, return a
879 .. index:: single: \g; in regular expressions
925 have regular expression metacharacters in it. For example::
950 Only characters that can have special meaning in a regular expression
956 Clear the regular expression cache.
962 valid regular expression (for example, it might contain unmatched parentheses)
973 The regular expression pattern.
995 Compiled regular expression objects support the following methods and
1000 Scan through *string* looking for the first location where this regular
1015 than *pos*, no match will be found; otherwise, if *rx* is a compiled regular
1027 If zero or more characters at the *beginning* of *string* match this regular
1046 If the whole *string* matches this regular expression, return a corresponding
1117 regular expression objects are considered atomic.
1173 If the regular expression uses the ``(?P<name>...)`` syntax, the *groupN*
1312 The :ref:`regular expression object <re-objects>` whose :meth:`~Pattern.match` or
1361 To match this with a regular expression, one could use backreferences as such::
1397 equivalent mappings between :c:func:`scanf` format tokens and regular
1430 The equivalent regular expression would be ::
1442 Python offers two different primitive operations based on regular expressions:
1462 beginning of the string, whereas using :func:`search` with a regular expression
1580 Raw string notation (``r"text"``) keeps regular expressions sane. Without it,
1581 every backslash (``'\'``) in a regular expression would have to be prefixed with
1590 When one wants to match a literal backslash, it must be escaped in the regular
1608 The text categories are specified with regular expressions. The technique is
1609 to combine those into a single master regular expression and to loop over
1685 but the first edition covered writing good regular expression patterns in