• Home
  • Raw
  • Download

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
34 will happen even if it is a valid escape sequence for a regular expression.
36 The solution is to use Python's raw string notation for regular expression
43 It is important to note that most regular expression operations are available as
45 :ref:`compiled regular expressions <re-objects>`. The functions are shortcuts
61 A regular expression (or RE) specifies a set of strings that matches it; the
63 regular expression (or if a given regular expression matches a particular
66 Regular expressions can be concatenated to form new regular expressions; if *A*
67 and *B* are both regular expressions, then *AB* is also a regular expression.
73 and implementation of regular expressions, consult the Friedl book [Frie09]_,
76 A brief explanation of the format of regular expressions follows. For further
80 ordinary characters, like ``'A'``, ``'a'``, or ``'0'``, are the simplest regular
88 how the regular expressions around them are interpreted.
99 .. index:: single: . (dot); in regular expressions
106 .. index:: single: ^ (caret); in regular expressions
112 .. index:: single: $ (dollar); in regular expressions
117 matches both 'foo' and 'foobar', while the regular expression ``foo$`` matches
123 .. index:: single: * (asterisk); in regular expressions
130 .. index:: single: + (plus); in regular expressions
137 .. index:: single: ? (question mark); in regular expressions
144 single: *?; in regular expressions
145 single: +?; in regular expressions
146 single: ??; in regular expressions
158 single: {} (curly brackets); in regular expressions
181 .. index:: single: \ (backslash); in regular expressions
197 single: [] (square brackets); in regular expressions
205 .. index:: single: - (minus); in regular expressions
218 .. index:: single: \ (backslash); in regular expressions
224 .. index:: single: ^ (caret); in regular expressions
237 .. .. index:: single: --; in regular expressions
238 .. .. index:: single: &&; in regular expressions
239 .. .. index:: single: ~~; in regular expressions
240 .. .. index:: single: ||; in regular expressions
256 .. index:: single: | (vertical bar); in regular expressions
259 ``A|B``, where *A* and *B* can be arbitrary REs, creates a regular expression that
270 single: () (parentheses); in regular expressions
273 Matches whatever regular expression is inside the parentheses, and indicates the
279 .. index:: single: (?; in regular expressions
295 for the entire regular expression.
298 regular expression, instead of passing a *flag* argument to the
302 .. index:: single: (?:; in regular expressions
305 A non-capturing version of regular parentheses. Matches whatever regular
336 .. index:: single: (?P<; in regular expressions
339 Similar to regular parentheses, but the substring matched by the group is
342 regular expression. A symbolic group is also a numbered group, just as if
363 .. index:: single: (?P=; in regular expressions
369 .. index:: single: (?#; in regular expressions
374 .. index:: single: (?=; in regular expressions
381 .. index:: single: (?!; in regular expressions
388 .. index:: single: (?<=; in regular expressions
415 .. index:: single: (?<!; in regular expressions
438 .. index:: single: \ (backslash); in regular expressions
450 .. index:: single: \A; in regular expressions
455 .. index:: single: \b; in regular expressions
471 .. index:: single: \B; in regular expressions
482 .. index:: single: \d; in regular expressions
494 .. index:: single: \D; in regular expressions
501 .. index:: single: \s; in regular expressions
515 .. index:: single: \S; in regular expressions
522 .. index:: single: \w; in regular expressions
537 .. index:: single: \W; in regular expressions
546 .. index:: single: \Z; in regular expressions
552 single: \a; in regular expressions
553 single: \b; in regular expressions
554 single: \f; in regular expressions
555 single: \n; in regular expressions
556 single: \N; in regular expressions
557 single: \r; in regular expressions
558 single: \t; in regular expressions
559 single: \u; in regular expressions
560 single: \U; in regular expressions
561 single: \v; in regular expressions
562 single: \x; in regular expressions
563 single: \\; in regular expressions
566 accepted by the regular expression parser::
602 regular expressions. Most non-trivial applications always use the compiled
611 Compile a regular expression pattern into a :ref:`regular expression object
629 but using :func:`re.compile` and saving the resulting regular expression
637 programs that use only a few regular expressions at a time needn't worry
638 about compiling regular expressions.
697 Compiled regular expression objects with the :const:`re.LOCALE` flag no
725 .. index:: single: # (hash); in regular expressions
727 This flag allows you to write regular expressions that look nicer and are
736 This means that the two following regular expression objects that match a
749 Scan through *string* looking for the first location where the regular expression
758 If zero or more characters at the beginning of *string* match the regular
772 If the whole *string* matches the regular expression *pattern*, return a
895 .. index:: single: \g; in regular expressions
942 have regular expression metacharacters in it. For example::
967 Only characters that can have special meaning in a regular expression
975 Clear the regular expression cache.
981 valid regular expression (for example, it might contain unmatched parentheses)
992 The regular expression pattern.
1014 Compiled regular expression objects support the following methods and
1019 Scan through *string* looking for the first location where this regular
1034 than *pos*, no match will be found; otherwise, if *rx* is a compiled regular
1046 If zero or more characters at the *beginning* of *string* match this regular
1065 If the whole *string* matches this regular expression, return a corresponding
1136 regular expression objects are considered atomic.
1192 If the regular expression uses the ``(?P<name>...)`` syntax, the *groupN*
1331 The :ref:`regular expression object <re-objects>` whose :meth:`~Pattern.match` or
1378 To match this with a regular expression, one could use backreferences as such::
1413 equivalent mappings between :c:func:`scanf` format tokens and regular
1446 The equivalent regular expression would be ::
1458 Python offers two different primitive operations based on regular expressions:
1478 beginning of the string, whereas using :func:`search` with a regular expression
1598 Raw string notation (``r"text"``) keeps regular expressions sane. Without it,
1599 every backslash (``'\'``) in a regular expression would have to be prefixed with
1608 When one wants to match a literal backslash, it must be escaped in the regular
1626 The text categories are specified with regular expressions. The technique is
1627 to combine those into a single master regular expression and to loop over
1707 but the first edition covered writing good regular expression patterns in