chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
580ca91e-15d8-4b28-a777-2916b067f45c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,397 | supabase-export-v2 | 8ed40800275d921b | ['Ross McFluff: 834.345.1254 155 Elm Street', 'Ronald Heathmore: 892.345.3428 436 Finley Avenue', 'Frank Burger: 925.541.7625 662 South Dogwood Way', 'Heather Albrecht: 548.326.4584 919 Park Place']
Finally, split each entry into a list with first name, last name, telephone
number, and address. We use the ``maxsplit`` ... | trusted_official_docs | CPython Docs | ['Ross McFluff: 834.345.1254 155 Elm Street', 'Ronald Heathmore: 892.345.3428 436 Finley Avenue', 'Frank Burger: 925.541.7625 662 South Dogwood Way', 'Heather Albrecht: 548.326.4584 919 Park Place']
Finally, split each entry into a list with first name, last name, telephone
number, and address. We use the ``maxsplit`` ... | ['Ross McFluff: 834.345.1254 155 Elm Street', 'Ronald Heathmore: 892.345.3428 436 Finley Avenue', 'Frank Burger: 925.541.7625 662 South Dogwood Way', 'Heather Albrecht: 548.326.4584 919 Park Place']
Finally, split each entry into a list with first name, last name, telephone
number, and address. We use the ``maxsplit`` ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
583cf81c-c598-4db9-9eb4-08309751f7b2 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,187 | supabase-export-v2 | 5d95225b5627c7a8 | 'r', 'd', 's', '', ''] >>> re.split(r'(\W*)', '...words...') ['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', '']
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | trusted_official_docs | CPython Docs | 'r', 'd', 's', '', ''] >>> re.split(r'(\W*)', '...words...') ['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', '']
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | 'r', 'd', 's', '', ''] >>> re.split(r'(\W*)', '...words...') ['', '...', '', '', 'w', '', 'o', '', 'r', '', 'd', '', 's', '...', '', '', '']
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
584e4958-17e5-4c4d-938b-c76eb5e4e725 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,163 | supabase-export-v2 | e967e965d3e0162b | if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | trusted_official_docs | CPython Docs | if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | if no position in the string matches the pattern; note that this is different from finding a zero-length match at some point in the string.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59b838c5-9198-4b8a-b06a-19315b81a319 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,056 | supabase-export-v2 | 371779c1be9e70cd | is not an ASCII digit or an ASCII letter, then the resulting RE will match the second character. For example, ``\$`` matches the character ``'$'``.
.. index:: single: \ (backslash); in regular expressions | trusted_official_docs | CPython Docs | is not an ASCII digit or an ASCII letter, then the resulting RE will match the second character. For example, ``\$`` matches the character ``'$'``.
.. index:: single: \ (backslash); in regular expressions | is not an ASCII digit or an ASCII letter, then the resulting RE will match the second character. For example, ``\$`` matches the character ``'$'``.
.. index:: single: \ (backslash); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
59f5348a-c1a0-4680-981f-bf108d140eac | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,043 | supabase-export-v2 | 96e29f07236daa37 | ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not* followed by ``'Asimov'``.
.. index:: single: (?<=; in regular expressions | trusted_official_docs | CPython Docs | ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not* followed by ``'Asimov'``.
.. index:: single: (?<=; in regular expressions | ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not* followed by ``'Asimov'``.
.. index:: single: (?<=; in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5a642697-6c35-401b-ac47-8e8d29021e1b | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,000 | supabase-export-v2 | 7a4605439f57b19f | ``-`` is escaped (e.g. ``[a\-z]``) or if it's placed as the first or last character (e.g. ``[-a]`` or ``[a-]``), it will match a literal ``'-'``.
* Special characters except backslash lose their special meaning inside sets. For example,
``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``,
``'*'``, or... | trusted_official_docs | CPython Docs | ``-`` is escaped (e.g. ``[a\-z]``) or if it's placed as the first or last character (e.g. ``[-a]`` or ``[a-]``), it will match a literal ``'-'``.
* Special characters except backslash lose their special meaning inside sets. For example,
``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``,
``'*'``, or... | ``-`` is escaped (e.g. ``[a\-z]``) or if it's placed as the first or last character (e.g. ``[-a]`` or ``[a-]``), it will match a literal ``'-'``.
* Special characters except backslash lose their special meaning inside sets. For example,
``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``,
``'*'``, or... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5bc1870f-a35a-42b6-a3b7-eaaaf39fe7bd | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,298 | supabase-export-v2 | c43fdcde911b7e05 | ``\2``) and named backreferences (``\g<1>``, ``\g<name>``) are replaced by the contents of the corresponding group. The backreference ``\g<0>`` will be replaced by the entire match.
.. versionchanged:: 3.5
Unmatched groups are replaced with an empty string. | trusted_official_docs | CPython Docs | ``\2``) and named backreferences (``\g<1>``, ``\g<name>``) are replaced by the contents of the corresponding group. The backreference ``\g<0>`` will be replaced by the entire match.
.. versionchanged:: 3.5
Unmatched groups are replaced with an empty string. | ``\2``) and named backreferences (``\g<1>``, ``\g<name>``) are replaced by the contents of the corresponding group. The backreference ``\g<0>`` will be replaced by the entire match.
.. versionchanged:: 3.5
Unmatched groups are replaced with an empty string. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5bd73f85-b4dd-4ddb-8476-eb3301d815a0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,058 | supabase-export-v2 | 15145440f3300cb7 | match, but as the character with octal value *number*. Inside the ``'['`` and ``']'`` of a character class, all numeric escapes are treated as characters.
.. index:: single: \A; in regular expressions | trusted_official_docs | CPython Docs | match, but as the character with octal value *number*. Inside the ``'['`` and ``']'`` of a character class, all numeric escapes are treated as characters.
.. index:: single: \A; in regular expressions | match, but as the character with octal value *number*. Inside the ``'['`` and ``']'`` of a character class, all numeric escapes are treated as characters.
.. index:: single: \A; in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5c133047-d704-48f3-ab9b-5c20e0b0d517 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,176 | supabase-export-v2 | bc8b4b7c9ad2f7bb | expression *pattern*, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise O... | trusted_official_docs | CPython Docs | expression *pattern*, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise O... | expression *pattern*, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise O... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5d9bab81-5cde-445c-b272-5800087813af | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,994 | supabase-export-v2 | b792a5f3ffb2dc43 | Either escapes special characters (permitting you to match characters like ``'*'``, ``'?'``, and so forth), or signals a special sequence; special sequences are discussed below.
If you're not using a raw string to express the pattern, remember that Python
also uses the backslash as an escape sequence in string literal... | trusted_official_docs | CPython Docs | Either escapes special characters (permitting you to match characters like ``'*'``, ``'?'``, and so forth), or signals a special sequence; special sequences are discussed below.
If you're not using a raw string to express the pattern, remember that Python
also uses the backslash as an escape sequence in string literal... | Either escapes special characters (permitting you to match characters like ``'*'``, ``'?'``, and so forth), or signals a special sequence; special sequences are discussed below.
If you're not using a raw string to express the pattern, remember that Python
also uses the backslash as an escape sequence in string literal... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5f6ba001-b91e-408d-bffe-a12fd60ade4c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,053 | supabase-export-v2 | fef1bc931b4e0f5d | omitted. For example, ``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which will match with ``'<user@host.com>'`` as well as ``'user@host.com'``, but not with ``'<user@host.com'`` nor ``'user@host.com>'``.
.. versionchanged:: 3.12
Group *id* can only contain ASCII digits. In :class:`bytes` patte... | trusted_official_docs | CPython Docs | omitted. For example, ``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which will match with ``'<user@host.com>'`` as well as ``'user@host.com'``, but not with ``'<user@host.com'`` nor ``'user@host.com>'``.
.. versionchanged:: 3.12
Group *id* can only contain ASCII digits. In :class:`bytes` patte... | omitted. For example, ``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>|$)`` is a poor email matching pattern, which will match with ``'<user@host.com>'`` as well as ``'user@host.com'``, but not with ``'<user@host.com'`` nor ``'user@host.com>'``.
.. versionchanged:: 3.12
Group *id* can only contain ASCII digits. In :class:`bytes` patte... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6002cb69-ef4d-411b-8c94-526fa11ff51f | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,255 | supabase-export-v2 | 9581ebf449fc3505 | than *pos*, no match will be found; otherwise, if *rx* is a compiled regular expression object, ``rx.search(string, 0, 50)`` is equivalent to ``rx.search(string[:50], 0)``. ::
>>> pattern = re.compile("d")
>>> pattern.search("dog") # Match at index 0
<re.Match object; span=(0, 1), match='d'>
>>> pattern.search("dog"... | trusted_official_docs | CPython Docs | than *pos*, no match will be found; otherwise, if *rx* is a compiled regular expression object, ``rx.search(string, 0, 50)`` is equivalent to ``rx.search(string[:50], 0)``. ::
>>> pattern = re.compile("d")
>>> pattern.search("dog") # Match at index 0
<re.Match object; span=(0, 1), match='d'>
>>> pattern.search("dog"... | than *pos*, no match will be found; otherwise, if *rx* is a compiled regular expression object, ``rx.search(string, 0, 50)`` is equivalent to ``rx.search(string[:50], 0)``. ::
>>> pattern = re.compile("d")
>>> pattern.search("dog") # Match at index 0
<re.Match object; span=(0, 1), match='d'>
>>> pattern.search("dog"... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
63005173-a5ff-432f-8b9e-33fc650b85f8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,129 | supabase-export-v2 | 39e8af7eedbf1ce9 | only works with 8-bit locales. Unicode matching is enabled by default for Unicode (str) patterns and it is able to handle different locales and languages.
.. versionchanged:: 3.6
:py:const:`~re.LOCALE` can be used only with bytes patterns
and is not compatible with :py:const:`~re.ASCII`. | trusted_official_docs | CPython Docs | only works with 8-bit locales. Unicode matching is enabled by default for Unicode (str) patterns and it is able to handle different locales and languages.
.. versionchanged:: 3.6
:py:const:`~re.LOCALE` can be used only with bytes patterns
and is not compatible with :py:const:`~re.ASCII`. | only works with 8-bit locales. Unicode matching is enabled by default for Unicode (str) patterns and it is able to handle different locales and languages.
.. versionchanged:: 3.6
:py:const:`~re.LOCALE` can be used only with bytes patterns
and is not compatible with :py:const:`~re.ASCII`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6425b82a-22ea-4a22-a570-f7dfb10e35e3 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,032 | supabase-export-v2 | bd5ac55e51bb21f0 | must be defined only once within a regular expression. A symbolic group is also a numbered group, just as if the group were not named.
Named groups can be referenced in three contexts. If the pattern is
``(?P<quote>['"]).*?(?P=quote)`` (i.e. matching a string quoted with either
single or double quotes): | trusted_official_docs | CPython Docs | must be defined only once within a regular expression. A symbolic group is also a numbered group, just as if the group were not named.
Named groups can be referenced in three contexts. If the pattern is
``(?P<quote>['"]).*?(?P=quote)`` (i.e. matching a string quoted with either
single or double quotes): | must be defined only once within a regular expression. A symbolic group is also a numbered group, just as if the group were not named.
Named groups can be referenced in three contexts. If the pattern is
``(?P<quote>['"]).*?(?P=quote)`` (i.e. matching a string quoted with either
single or double quotes): | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
648fe686-ca5c-4283-80ec-37dd27a3d0ab | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,404 | supabase-export-v2 | a14fb06fcfdc039c | Text munging ^^^^^^^^^^^^
:func:`sub` replaces every occurrence of a pattern with a string or the
result of a function. This example demonstrates using :func:`sub` with
a function to "munge" text, or randomize the order of all the characters
in each word of a sentence except for the first and last characters:: | trusted_official_docs | CPython Docs | Text munging ^^^^^^^^^^^^
:func:`sub` replaces every occurrence of a pattern with a string or the
result of a function. This example demonstrates using :func:`sub` with
a function to "munge" text, or randomize the order of all the characters
in each word of a sentence except for the first and last characters:: | Text munging ^^^^^^^^^^^^
:func:`sub` replaces every occurrence of a pattern with a string or the
result of a function. This example demonstrates using :func:`sub` with
a function to "munge" text, or randomize the order of all the characters
in each word of a sentence except for the first and last characters:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
65cc41eb-8b18-42cd-81fb-b46c5ab08df9 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,413 | supabase-export-v2 | 6c624b784c806b62 | Raw string notation ^^^^^^^^^^^^^^^^^^^
Raw string notation (``r"text"``) keeps regular expressions sane. Without it,
every backslash (``'\'``) in a regular expression would have to be prefixed with
another one to escape it. For example, the two following lines of code are
functionally identical:: | trusted_official_docs | CPython Docs | Raw string notation ^^^^^^^^^^^^^^^^^^^
Raw string notation (``r"text"``) keeps regular expressions sane. Without it,
every backslash (``'\'``) in a regular expression would have to be prefixed with
another one to escape it. For example, the two following lines of code are
functionally identical:: | Raw string notation ^^^^^^^^^^^^^^^^^^^
Raw string notation (``r"text"``) keeps regular expressions sane. Without it,
every backslash (``'\'``) in a regular expression would have to be prefixed with
another one to escape it. For example, the two following lines of code are
functionally identical:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
65d83c6d-db2b-4214-9183-1009dc4b1755 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,173 | supabase-export-v2 | 3b9292472ffa07ac | .. function:: match(pattern, string, flags=0)
.. soft-deprecated:: 3.15
:func:`~re.match` has been :term:`soft deprecated` in favor of
the alternate :func:`~re.prefixmatch` name of this API which is
more explicitly descriptive. Use it to better
express intent. The norm in other languages and regular expression
imp... | trusted_official_docs | CPython Docs | .. function:: match(pattern, string, flags=0)
.. soft-deprecated:: 3.15
:func:`~re.match` has been :term:`soft deprecated` in favor of
the alternate :func:`~re.prefixmatch` name of this API which is
more explicitly descriptive. Use it to better
express intent. The norm in other languages and regular expression
imp... | .. function:: match(pattern, string, flags=0)
.. soft-deprecated:: 3.15
:func:`~re.match` has been :term:`soft deprecated` in favor of
the alternate :func:`~re.prefixmatch` name of this API which is
more explicitly descriptive. Use it to better
express intent. The norm in other languages and regular expression
imp... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
66a0f932-967e-44b5-94e0-9b569e3c038e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,379 | supabase-export-v2 | 350923a5adbdf581 | >>> re.prefixmatch("c", "abcdef") # No match >>> re.search("^c", "abcdef") # No match >>> re.search("^a", "abcdef") # Match <re.Match object; span=(0, 1), match='a'>
Note however that in :const:`MULTILINE` mode :func:`prefixmatch` only matches at the
beginning of the string, whereas using :func:`search` with a regular ... | trusted_official_docs | CPython Docs | >>> re.prefixmatch("c", "abcdef") # No match >>> re.search("^c", "abcdef") # No match >>> re.search("^a", "abcdef") # Match <re.Match object; span=(0, 1), match='a'>
Note however that in :const:`MULTILINE` mode :func:`prefixmatch` only matches at the
beginning of the string, whereas using :func:`search` with a regular ... | >>> re.prefixmatch("c", "abcdef") # No match >>> re.search("^c", "abcdef") # No match >>> re.search("^a", "abcdef") # Match <re.Match object; span=(0, 1), match='a'>
Note however that in :const:`MULTILINE` mode :func:`prefixmatch` only matches at the
beginning of the string, whereas using :func:`search` with a regular ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
66ec783a-4ab8-4e66-a6e3-abaf6e5fa920 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,376 | supabase-export-v2 | 5b73dea005548054 | For example::
>>> re.prefixmatch("c", "abcdef") # No match
>>> re.search("c", "abcdef") # Match
<re.Match object; span=(2, 3), match='c'>
>>> re.fullmatch("p.*n", "python") # Match
<re.Match object; span=(0, 6), match='python'>
>>> re.fullmatch("r.*n", "python") # No match | trusted_official_docs | CPython Docs | For example::
>>> re.prefixmatch("c", "abcdef") # No match
>>> re.search("c", "abcdef") # Match
<re.Match object; span=(2, 3), match='c'>
>>> re.fullmatch("p.*n", "python") # Match
<re.Match object; span=(0, 6), match='python'>
>>> re.fullmatch("r.*n", "python") # No match | For example::
>>> re.prefixmatch("c", "abcdef") # No match
>>> re.search("c", "abcdef") # Match
<re.Match object; span=(2, 3), match='c'>
>>> re.fullmatch("p.*n", "python") # Match
<re.Match object; span=(0, 6), match='python'>
>>> re.fullmatch("r.*n", "python") # No match | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
671a215e-113e-4490-9dce-e035727b1b28 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,423 | supabase-export-v2 | 63a9a25b91804143 | mo.end() line_num += 1 continue elif kind == 'SKIP': continue elif kind == 'MISMATCH': raise RuntimeError(f'{value!r} unexpected on line {line_num}') yield Token(kind, value, line_num, column)
statements = '''
IF quantity THEN
total := total + price * quantity;
tax := price * 0.05;
ENDIF;
''' | trusted_official_docs | CPython Docs | mo.end() line_num += 1 continue elif kind == 'SKIP': continue elif kind == 'MISMATCH': raise RuntimeError(f'{value!r} unexpected on line {line_num}') yield Token(kind, value, line_num, column)
statements = '''
IF quantity THEN
total := total + price * quantity;
tax := price * 0.05;
ENDIF;
''' | mo.end() line_num += 1 continue elif kind == 'SKIP': continue elif kind == 'MISMATCH': raise RuntimeError(f'{value!r} unexpected on line {line_num}') yield Token(kind, value, line_num, column)
statements = '''
IF quantity THEN
total := total + price * quantity;
tax := price * 0.05;
ENDIF;
''' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67a54584-c236-4674-989d-3cce895de391 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,086 | supabase-export-v2 | a605aeed2afc791c | Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used.
For 8-bit (bytes) patterns:
Matches characters considered alphanumeric in the ASCII character set;
this is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is used,
matches characters considered alphanumeric in the current locale a... | trusted_official_docs | CPython Docs | Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used.
For 8-bit (bytes) patterns:
Matches characters considered alphanumeric in the ASCII character set;
this is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is used,
matches characters considered alphanumeric in the current locale a... | Matches ``[a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used.
For 8-bit (bytes) patterns:
Matches characters considered alphanumeric in the ASCII character set;
this is equivalent to ``[a-zA-Z0-9_]``. If the :py:const:`~re.LOCALE` flag is used,
matches characters considered alphanumeric in the current locale a... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
67fc02cc-0938-45df-897c-aace36ce6fa4 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,184 | supabase-export-v2 | cb7252379bb045de | That way, separator components are always found at the same relative indices within the result list.
Adjacent empty matches are not possible, but an empty match can occur
immediately after a non-empty match. | trusted_official_docs | CPython Docs | That way, separator components are always found at the same relative indices within the result list.
Adjacent empty matches are not possible, but an empty match can occur
immediately after a non-empty match. | That way, separator components are always found at the same relative indices within the result list.
Adjacent empty matches are not possible, but an empty match can occur
immediately after a non-empty match. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
69876e8f-cde5-4519-bbaf-761acc1bffcc | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,024 | supabase-export-v2 | 12d2df083e22eb58 | (ASCII-only matching) * :const:`re.I` (ignore case) * :const:`re.L` (locale dependent) * :const:`re.M` (multi-line) * :const:`re.S` (dot matches all) * :const:`re.U` (Unicode matching) * :const:`re.X` (verbose)
(The flags are described in :ref:`contents-of-module-re`.) | trusted_official_docs | CPython Docs | (ASCII-only matching) * :const:`re.I` (ignore case) * :const:`re.L` (locale dependent) * :const:`re.M` (multi-line) * :const:`re.S` (dot matches all) * :const:`re.U` (Unicode matching) * :const:`re.X` (verbose)
(The flags are described in :ref:`contents-of-module-re`.) | (ASCII-only matching) * :const:`re.I` (ignore case) * :const:`re.L` (locale dependent) * :const:`re.M` (multi-line) * :const:`re.S` (dot matches all) * :const:`re.U` (Unicode matching) * :const:`re.X` (verbose)
(The flags are described in :ref:`contents-of-module-re`.) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
69a41d80-e80b-4a89-a2f8-ef638924fcb0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,007 | supabase-export-v2 | 9a26c77e2ac4ec24 | expressions .. .. index:: single: &&; in regular expressions .. .. index:: single: ~~; in regular expressions .. .. index:: single: ||; in regular expressions
* Support of nested sets and set operations as in `Unicode Technical
Standard #18`_ might be added in the future. This would change the
syntax, so to facilitat... | trusted_official_docs | CPython Docs | expressions .. .. index:: single: &&; in regular expressions .. .. index:: single: ~~; in regular expressions .. .. index:: single: ||; in regular expressions
* Support of nested sets and set operations as in `Unicode Technical
Standard #18`_ might be added in the future. This would change the
syntax, so to facilitat... | expressions .. .. index:: single: &&; in regular expressions .. .. index:: single: ~~; in regular expressions .. .. index:: single: ||; in regular expressions
* Support of nested sets and set operations as in `Unicode Technical
Standard #18`_ might be added in the future. This would change the
syntax, so to facilitat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6adc0d74-0813-465e-8737-f9d53d010353 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,316 | supabase-export-v2 | 976a1e07ab5c010f | .. method:: Match.groups(default=None)
Return a tuple containing all the subgroups of the match, from 1 up to however
many groups are in the pattern. The *default* argument is used for groups that
did not participate in the match; it defaults to ``None``. | trusted_official_docs | CPython Docs | .. method:: Match.groups(default=None)
Return a tuple containing all the subgroups of the match, from 1 up to however
many groups are in the pattern. The *default* argument is used for groups that
did not participate in the match; it defaults to ``None``. | .. method:: Match.groups(default=None)
Return a tuple containing all the subgroups of the match, from 1 up to however
many groups are in the pattern. The *default* argument is used for groups that
did not participate in the match; it defaults to ``None``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b8d50f7-83cf-425e-8737-14f69d5a79c5 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,042 | supabase-export-v2 | d03a8b47f006be65 | .. index:: single: (?!; in regular expressions
``(?!...)``
Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not*
followed by ``'Asimov'``. | trusted_official_docs | CPython Docs | .. index:: single: (?!; in regular expressions
``(?!...)``
Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not*
followed by ``'Asimov'``. | .. index:: single: (?!; in regular expressions
``(?!...)``
Matches if ``...`` doesn't match next. This is a :dfn:`negative lookahead assertion`. For example, ``Isaac (?!Asimov)`` will match ``'Isaac '`` only if it's *not*
followed by ``'Asimov'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c85c46a-b6a6-4c86-83b1-35b880c65e65 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,355 | supabase-export-v2 | e0ae7652be626248 | = re.compile(r".*(.).*\1") >>> displaymatch(pair_re.prefixmatch("717ak")) # Pair of 7s. "<Match: '717', groups=('7',)>" >>> displaymatch(pair_re.prefixmatch("718ak")) # No pairs. >>> displaymatch(pair_re.prefixmatch("354aa")) # Pair of aces. "<Match: '354aa', groups=('a',)>"
To find out what card the pair consists of, ... | trusted_official_docs | CPython Docs | = re.compile(r".*(.).*\1") >>> displaymatch(pair_re.prefixmatch("717ak")) # Pair of 7s. "<Match: '717', groups=('7',)>" >>> displaymatch(pair_re.prefixmatch("718ak")) # No pairs. >>> displaymatch(pair_re.prefixmatch("354aa")) # Pair of aces. "<Match: '354aa', groups=('a',)>"
To find out what card the pair consists of, ... | = re.compile(r".*(.).*\1") >>> displaymatch(pair_re.prefixmatch("717ak")) # Pair of 7s. "<Match: '717', groups=('7',)>" >>> displaymatch(pair_re.prefixmatch("718ak")) # No pairs. >>> displaymatch(pair_re.prefixmatch("354aa")) # Pair of aces. "<Match: '354aa', groups=('a',)>"
To find out what card the pair consists of, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d146a0b-115c-460b-8ea8-385d874a47fb | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,015 | supabase-export-v2 | 2f2c865697e11616 | .. index:: single: (?; in regular expressions
``(?...)``
This is an extension notation (a ``'?'`` following a ``'('`` is not meaningful
otherwise). The first character after the ``'?'`` determines what the meaning
and further syntax of the construct is. Extensions usually do not create a new
group; ``(?P<name>...)`... | trusted_official_docs | CPython Docs | .. index:: single: (?; in regular expressions
``(?...)``
This is an extension notation (a ``'?'`` following a ``'('`` is not meaningful
otherwise). The first character after the ``'?'`` determines what the meaning
and further syntax of the construct is. Extensions usually do not create a new
group; ``(?P<name>...)`... | .. index:: single: (?; in regular expressions
``(?...)``
This is an extension notation (a ``'?'`` following a ``'('`` is not meaningful
otherwise). The first character after the ``'?'`` determines what the meaning
and further syntax of the construct is. Extensions usually do not create a new
group; ``(?P<name>...)`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6d243b1b-6e27-4bd0-bcdb-e82f35a09cb8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,399 | supabase-export-v2 | 859b85b0f7e81c32 | .. doctest:: :options: +NORMALIZE_WHITESPACE
>>> [re.split(":? ", entry, maxsplit=3) for entry in entries]
[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],
['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],
['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],
['Heather', 'Albrecht', '548.... | trusted_official_docs | CPython Docs | .. doctest:: :options: +NORMALIZE_WHITESPACE
>>> [re.split(":? ", entry, maxsplit=3) for entry in entries]
[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],
['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],
['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],
['Heather', 'Albrecht', '548.... | .. doctest:: :options: +NORMALIZE_WHITESPACE
>>> [re.split(":? ", entry, maxsplit=3) for entry in entries]
[['Ross', 'McFluff', '834.345.1254', '155 Elm Street'],
['Ronald', 'Heathmore', '892.345.3428', '436 Finley Avenue'],
['Frank', 'Burger', '925.541.7625', '662 South Dogwood Way'],
['Heather', 'Albrecht', '548.... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6da15c84-396b-4bcb-b08d-91d1b162dd7b | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,258 | supabase-export-v2 | 528418c0daf5b07c | regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
Note that even in :const:`MULTILINE` mode, this will only match at the
beginning of the string and not at the beginning of each line. | trusted_official_docs | CPython Docs | regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
Note that even in :const:`MULTILINE` mode, this will only match at the
beginning of the string and not at the beginning of each line. | regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
Note that even in :const:`MULTILINE` mode, this will only match at the
beginning of the string and not at the beginning of each line. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6f9d6183-6fbe-4e0c-aa6e-be3064242cde | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,386 | supabase-export-v2 | d482cc148ecbc155 | intended semantics. When reading :func:`!match` there remains a seed of doubt about the intended behavior to anyone not already familiar with this old Python gotcha.
We **do not** plan to remove the older :func:`!match` name,
as it has been used in code for over 30 years. It has been :term:`soft deprecated`:
code suppo... | trusted_official_docs | CPython Docs | intended semantics. When reading :func:`!match` there remains a seed of doubt about the intended behavior to anyone not already familiar with this old Python gotcha.
We **do not** plan to remove the older :func:`!match` name,
as it has been used in code for over 30 years. It has been :term:`soft deprecated`:
code suppo... | intended semantics. When reading :func:`!match` there remains a seed of doubt about the intended behavior to anyone not already familiar with this old Python gotcha.
We **do not** plan to remove the older :func:`!match` name,
as it has been used in code for over 30 years. It has been :term:`soft deprecated`:
code suppo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7030df36-b39d-4073-a10d-55d971db0d37 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,023 | supabase-export-v2 | cbd59bb9d6811ec0 | by one or more letters from the ``'i'``, ``'m'``, ``'s'``, ``'x'``.) The letters set or remove the corresponding flags for the part of the expression:
* :const:`re.A` (ASCII-only matching)
* :const:`re.I` (ignore case)
* :const:`re.L` (locale dependent)
* :const:`re.M` (multi-line)
* :const:`re.S` (dot matches all)... | trusted_official_docs | CPython Docs | by one or more letters from the ``'i'``, ``'m'``, ``'s'``, ``'x'``.) The letters set or remove the corresponding flags for the part of the expression:
* :const:`re.A` (ASCII-only matching)
* :const:`re.I` (ignore case)
* :const:`re.L` (locale dependent)
* :const:`re.M` (multi-line)
* :const:`re.S` (dot matches all)... | by one or more letters from the ``'i'``, ``'m'``, ``'s'``, ``'x'``.) The letters set or remove the corresponding flags for the part of the expression:
* :const:`re.A` (ASCII-only matching)
* :const:`re.I` (ignore case)
* :const:`re.L` (locale dependent)
* :const:`re.M` (multi-line)
* :const:`re.S` (dot matches all)... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
72eac918-486a-4250-b38a-2840d045dff8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,988 | supabase-export-v2 | 80aef952f60e6836 | RE should be matched; fewer matches cause the entire RE not to match. For example, ``a{6}`` will match exactly six ``'a'`` characters, but not five.
``{m,n}``
Causes the resulting RE to match from *m* to *n* repetitions of the preceding
RE, attempting to match as many repetitions as possible. For example,
``a{3,5}``... | trusted_official_docs | CPython Docs | RE should be matched; fewer matches cause the entire RE not to match. For example, ``a{6}`` will match exactly six ``'a'`` characters, but not five.
``{m,n}``
Causes the resulting RE to match from *m* to *n* repetitions of the preceding
RE, attempting to match as many repetitions as possible. For example,
``a{3,5}``... | RE should be matched; fewer matches cause the entire RE not to match. For example, ``a{6}`` will match exactly six ``'a'`` characters, but not five.
``{m,n}``
Causes the resulting RE to match from *m* to *n* repetitions of the preceding
RE, attempting to match as many repetitions as possible. For example,
``a{3,5}``... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73c16d3a-e4d4-4cc7-a946-4abd8b2315ae | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,956 | supabase-export-v2 | 658e8a5086ab5ecb | ``'\'`` and ``'n'``, while ``"\n"`` is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.
It is important to note that most regular expression operations are available as
module-level functions and methods on
:ref:`compiled regular expressions ... | trusted_official_docs | CPython Docs | ``'\'`` and ``'n'``, while ``"\n"`` is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.
It is important to note that most regular expression operations are available as
module-level functions and methods on
:ref:`compiled regular expressions ... | ``'\'`` and ``'n'``, while ``"\n"`` is a one-character string containing a newline. Usually patterns will be expressed in Python code using this raw string notation.
It is important to note that most regular expression operations are available as
module-level functions and methods on
:ref:`compiled regular expressions ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73d9f666-0796-40ff-8f49-203c38a633d0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,069 | supabase-export-v2 | 0d8c5cc21eb94645 | .. index:: single: \d; in regular expressions
``\d``
For Unicode (str) patterns:
Matches any Unicode decimal digit
(that is, any character in Unicode character category `[Nd]`__). This includes ``[0-9]``, and also many other digit characters. | trusted_official_docs | CPython Docs | .. index:: single: \d; in regular expressions
``\d``
For Unicode (str) patterns:
Matches any Unicode decimal digit
(that is, any character in Unicode character category `[Nd]`__). This includes ``[0-9]``, and also many other digit characters. | .. index:: single: \d; in regular expressions
``\d``
For Unicode (str) patterns:
Matches any Unicode decimal digit
(that is, any character in Unicode character category `[Nd]`__). This includes ``[0-9]``, and also many other digit characters. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73ddbf6e-74ab-478b-b6a4-66e24ff49019 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,259 | supabase-export-v2 | bc956569ebe4b34c | Note that even in :const:`MULTILINE` mode, this will only match at the beginning of the string and not at the beginning of each line.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`~Pattern.search` method. :: | trusted_official_docs | CPython Docs | Note that even in :const:`MULTILINE` mode, this will only match at the beginning of the string and not at the beginning of each line.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`~Pattern.search` method. :: | Note that even in :const:`MULTILINE` mode, this will only match at the beginning of the string and not at the beginning of each line.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`~Pattern.search` method. :: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
73e39936-d423-4228-98ba-8c030e5d061c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,260 | supabase-export-v2 | 0b8b00ebe19465c8 | The optional *pos* and *endpos* parameters have the same meaning as for the :meth:`~Pattern.search` method. ::
>>> pattern = re.compile("o")
>>> pattern.prefixmatch("dog") # No match as "o" is not at the start of "dog". >>> pattern.prefixmatch("dog", 1) # Match as "o" is the 2nd character of "dog". <re.Match object; s... | trusted_official_docs | CPython Docs | The optional *pos* and *endpos* parameters have the same meaning as for the :meth:`~Pattern.search` method. ::
>>> pattern = re.compile("o")
>>> pattern.prefixmatch("dog") # No match as "o" is not at the start of "dog". >>> pattern.prefixmatch("dog", 1) # Match as "o" is the 2nd character of "dog". <re.Match object; s... | The optional *pos* and *endpos* parameters have the same meaning as for the :meth:`~Pattern.search` method. ::
>>> pattern = re.compile("o")
>>> pattern.prefixmatch("dog") # No match as "o" is not at the start of "dog". >>> pattern.prefixmatch("dog", 1) # Match as "o" is the 2nd character of "dog". <re.Match object; s... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
74794ba4-78f4-4c3f-873b-a43b937fb049 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,335 | supabase-export-v2 | 71de6c59e4ac59c2 | .. attribute:: Match.endpos
The value of *endpos* which was passed to the :meth:`~Pattern.search` or
:meth:`~Pattern.match` method of a :ref:`regex object <re-objects>`. This is
the index into the string beyond which the RE engine will not go. | trusted_official_docs | CPython Docs | .. attribute:: Match.endpos
The value of *endpos* which was passed to the :meth:`~Pattern.search` or
:meth:`~Pattern.match` method of a :ref:`regex object <re-objects>`. This is
the index into the string beyond which the RE engine will not go. | .. attribute:: Match.endpos
The value of *endpos* which was passed to the :meth:`~Pattern.search` or
:meth:`~Pattern.match` method of a :ref:`regex object <re-objects>`. This is
the index into the string beyond which the RE engine will not go. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
75b5c273-4b81-4000-8e12-5abf28d723b9 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,084 | supabase-export-v2 | 9cc934b5ded48e2b | .. index:: single: \w; in regular expressions
``\w``
For Unicode (str) patterns:
Matches Unicode word characters;
this includes all Unicode alphanumeric characters
(as defined by :py:meth:`str.isalnum`),
as well as the underscore (``_``). | trusted_official_docs | CPython Docs | .. index:: single: \w; in regular expressions
``\w``
For Unicode (str) patterns:
Matches Unicode word characters;
this includes all Unicode alphanumeric characters
(as defined by :py:meth:`str.isalnum`),
as well as the underscore (``_``). | .. index:: single: \w; in regular expressions
``\w``
For Unicode (str) patterns:
Matches Unicode word characters;
this includes all Unicode alphanumeric characters
(as defined by :py:meth:`str.isalnum`),
as well as the underscore (``_``). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
78de3264-d08c-44f1-9352-8b49c7c98f01 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,182 | supabase-export-v2 | 17c8135c9a8245b7 | it matches at the start of the string, the result will start with an empty string. The same holds for the end of the string::
>>> re.split(r'(\W+)', '...words, words...')
['', '...', 'words', ', ', 'words', '...', ''] | trusted_official_docs | CPython Docs | it matches at the start of the string, the result will start with an empty string. The same holds for the end of the string::
>>> re.split(r'(\W+)', '...words, words...')
['', '...', 'words', ', ', 'words', '...', ''] | it matches at the start of the string, the result will start with an empty string. The same holds for the end of the string::
>>> re.split(r'(\W+)', '...words, words...')
['', '...', 'words', ', ', 'words', '...', ''] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7995a867-90d0-4c54-ae98-12f78d033ac3 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,380 | supabase-export-v2 | 16e26b2fbb73195d | at the beginning of the string, whereas using :func:`search` with a regular expression beginning with ``'^'`` will match at the beginning of each line. ::
>>> re.prefixmatch("X", "A\nB\nX", re.MULTILINE) # No match
>>> re.search("^X", "A\nB\nX", re.MULTILINE) # Match
<re.Match object; span=(4, 5), match='X'> | trusted_official_docs | CPython Docs | at the beginning of the string, whereas using :func:`search` with a regular expression beginning with ``'^'`` will match at the beginning of each line. ::
>>> re.prefixmatch("X", "A\nB\nX", re.MULTILINE) # No match
>>> re.search("^X", "A\nB\nX", re.MULTILINE) # Match
<re.Match object; span=(4, 5), match='X'> | at the beginning of the string, whereas using :func:`search` with a regular expression beginning with ``'^'`` will match at the beginning of each line. ::
>>> re.prefixmatch("X", "A\nB\nX", re.MULTILINE) # No match
>>> re.search("^X", "A\nB\nX", re.MULTILINE) # Match
<re.Match object; span=(4, 5), match='X'> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7a051f05-ebbc-4bef-8eda-6bc636c28450 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,006 | supabase-export-v2 | b44d4398968c3ad2 | at the beginning of the set. For example, both ``[()[\]{}]`` and ``[]()[{}]`` will match a right bracket, as well as left bracket, braces, and parentheses.
.. .. index:: single: --; in regular expressions
.. .. index:: single: &&; in regular expressions
.. .. index:: single: ~~; in regular expressions
.. .. index:: ... | trusted_official_docs | CPython Docs | at the beginning of the set. For example, both ``[()[\]{}]`` and ``[]()[{}]`` will match a right bracket, as well as left bracket, braces, and parentheses.
.. .. index:: single: --; in regular expressions
.. .. index:: single: &&; in regular expressions
.. .. index:: single: ~~; in regular expressions
.. .. index:: ... | at the beginning of the set. For example, both ``[()[\]{}]`` and ``[]()[{}]`` will match a right bracket, as well as left bracket, braces, and parentheses.
.. .. index:: single: --; in regular expressions
.. .. index:: single: &&; in regular expressions
.. .. index:: single: ~~; in regular expressions
.. .. index:: ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7c643bcb-6e1f-458b-99fe-895329742a28 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,993 | supabase-export-v2 | f8fbe9031a5302f4 | .. index:: single: \ (backslash); in regular expressions
``\``
Either escapes special characters (permitting you to match characters like
``'*'``, ``'?'``, and so forth), or signals a special sequence; special
sequences are discussed below. | trusted_official_docs | CPython Docs | .. index:: single: \ (backslash); in regular expressions
``\``
Either escapes special characters (permitting you to match characters like
``'*'``, ``'?'``, and so forth), or signals a special sequence; special
sequences are discussed below. | .. index:: single: \ (backslash); in regular expressions
``\``
Either escapes special characters (permitting you to match characters like
``'*'``, ``'?'``, and so forth), or signals a special sequence; special
sequences are discussed below. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e509265-dfb0-4fc1-9bf9-4aaf3d42f9ca | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,297 | supabase-export-v2 | 00e0d778a35fec05 | .. method:: Match.expand(template)
Return the string obtained by doing backslash substitution on the template
string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such as ``\n`` are converted to the appropriate characters,
and numeric backreferences (``\1``, ``\2``) and named backreferences
(``\g<1... | trusted_official_docs | CPython Docs | .. method:: Match.expand(template)
Return the string obtained by doing backslash substitution on the template
string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such as ``\n`` are converted to the appropriate characters,
and numeric backreferences (``\1``, ``\2``) and named backreferences
(``\g<1... | .. method:: Match.expand(template)
Return the string obtained by doing backslash substitution on the template
string *template*, as done by the :meth:`~Pattern.sub` method. Escapes such as ``\n`` are converted to the appropriate characters,
and numeric backreferences (``\1``, ``\2``) and named backreferences
(``\g<1... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e567889-04d8-4e96-ac85-4081ba04306e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,034 | supabase-export-v2 | c807256f5238a4b8 | in a string passed to the *repl* | * ``\g<quote>`` | | argument of ``re.sub()`` | * ``\g<1>`` | | | * ``\1`` | +---------------------------------------+----------------------------------+
.. versionchanged:: 3.12
In :class:`bytes` patterns, group *name* can only contain bytes
in the ASCII range (``b'\x00'``-``b'\x7f'... | trusted_official_docs | CPython Docs | in a string passed to the *repl* | * ``\g<quote>`` | | argument of ``re.sub()`` | * ``\g<1>`` | | | * ``\1`` | +---------------------------------------+----------------------------------+
.. versionchanged:: 3.12
In :class:`bytes` patterns, group *name* can only contain bytes
in the ASCII range (``b'\x00'``-``b'\x7f'... | in a string passed to the *repl* | * ``\g<quote>`` | | argument of ``re.sub()`` | * ``\g<1>`` | | | * ``\1`` | +---------------------------------------+----------------------------------+
.. versionchanged:: 3.12
In :class:`bytes` patterns, group *name* can only contain bytes
in the ASCII range (``b'\x00'``-``b'\x7f'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80e12d75-f17c-4ada-ba92-e5a65dbbba2b | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,057 | supabase-export-v2 | 6f03bca5552853f7 | .. index:: single: \ (backslash); in regular expressions
``\number``
Matches the contents of the group of the same number. Groups are numbered
starting from 1. For example, ``(.+) \1`` matches ``'the the'`` or ``'55 55'``,
but not ``'thethe'`` (note the space after the group). This special sequence
can only be used... | trusted_official_docs | CPython Docs | .. index:: single: \ (backslash); in regular expressions
``\number``
Matches the contents of the group of the same number. Groups are numbered
starting from 1. For example, ``(.+) \1`` matches ``'the the'`` or ``'55 55'``,
but not ``'thethe'`` (note the space after the group). This special sequence
can only be used... | .. index:: single: \ (backslash); in regular expressions
``\number``
Matches the contents of the group of the same number. Groups are numbered
starting from 1. For example, ``(.+) \1`` matches ``'the the'`` or ``'55 55'``,
but not ``'thethe'`` (note the space after the group). This special sequence
can only be used... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
80f136a8-4b93-4e0b-a598-b834cc37042a | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,062 | supabase-export-v2 | 075a463dd01dbea3 | and the beginning or end of the string. This means that ``r'\bat\b'`` matches ``'at'``, ``'at.'``, ``'(at)'``, and ``'as at ay'`` but not ``'attempt'`` or ``'atlas'``.
The default word characters in Unicode (str) patterns
are Unicode alphanumerics and the underscore,
but this can be changed by using the :py:const:`~r... | trusted_official_docs | CPython Docs | and the beginning or end of the string. This means that ``r'\bat\b'`` matches ``'at'``, ``'at.'``, ``'(at)'``, and ``'as at ay'`` but not ``'attempt'`` or ``'atlas'``.
The default word characters in Unicode (str) patterns
are Unicode alphanumerics and the underscore,
but this can be changed by using the :py:const:`~r... | and the beginning or end of the string. This means that ``r'\bat\b'`` matches ``'at'``, ``'at.'``, ``'(at)'``, and ``'as at ay'`` but not ``'attempt'`` or ``'atlas'``.
The default word characters in Unicode (str) patterns
are Unicode alphanumerics and the underscore,
but this can be changed by using the :py:const:`~r... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8161d4a1-fd08-4afc-b2ca-7c975858ad59 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,408 | supabase-export-v2 | 15af0aa997d4bcd9 | :func:`search` does. For example, if a writer wanted to find all of the adverbs in some text, they might use :func:`findall` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
>>> re.findall(r"\w+ly\b", text)
['carefully', 'quickly'] | trusted_official_docs | CPython Docs | :func:`search` does. For example, if a writer wanted to find all of the adverbs in some text, they might use :func:`findall` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
>>> re.findall(r"\w+ly\b", text)
['carefully', 'quickly'] | :func:`search` does. For example, if a writer wanted to find all of the adverbs in some text, they might use :func:`findall` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
>>> re.findall(r"\w+ly\b", text)
['carefully', 'quickly'] | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
833b84f8-2c78-4864-94bc-24390430f180 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,019 | supabase-export-v2 | 93ed6b4fa2f3e495 | as part of the regular expression, instead of passing a *flag* argument to the :func:`re.compile` function. Flags should be used first in the expression string.
.. versionchanged:: 3.11
This construction can only be used at the start of the expression. | trusted_official_docs | CPython Docs | as part of the regular expression, instead of passing a *flag* argument to the :func:`re.compile` function. Flags should be used first in the expression string.
.. versionchanged:: 3.11
This construction can only be used at the start of the expression. | as part of the regular expression, instead of passing a *flag* argument to the :func:`re.compile` function. Flags should be used first in the expression string.
.. versionchanged:: 3.11
This construction can only be used at the start of the expression. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
845176e0-4293-41cb-b3fe-0a2361d47e9f | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,976 | supabase-export-v2 | 930b5b592455a0bb | more repetitions of the preceding RE, as many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed by any number of 'b's.
.. index:: single: + (plus); in regular expressions | trusted_official_docs | CPython Docs | more repetitions of the preceding RE, as many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed by any number of 'b's.
.. index:: single: + (plus); in regular expressions | more repetitions of the preceding RE, as many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed by any number of 'b's.
.. index:: single: + (plus); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8485c163-846e-4b55-9f30-c070bba6ce61 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,984 | supabase-export-v2 | 944c8f59f1bdd948 | ``'a'``, but when the final ``'a'`` fails to find any more characters to match, the expression cannot be backtracked and will thus fail to match.
``x*+``, ``x++`` and ``x?+`` are equivalent to ``(?>x*)``, ``(?>x+)``
and ``(?>x?)`` correspondingly. | trusted_official_docs | CPython Docs | ``'a'``, but when the final ``'a'`` fails to find any more characters to match, the expression cannot be backtracked and will thus fail to match.
``x*+``, ``x++`` and ``x?+`` are equivalent to ``(?>x*)``, ``(?>x+)``
and ``(?>x?)`` correspondingly. | ``'a'``, but when the final ``'a'`` fails to find any more characters to match, the expression cannot be backtracked and will thus fail to match.
``x*+``, ``x++`` and ``x?+`` are equivalent to ``(?>x*)``, ``(?>x+)``
and ``(?>x?)`` correspondingly. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8531e73b-4b26-4153-908f-193f4ec2ea2a | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,097 | supabase-export-v2 | 063e0c5791082118 | Most of the :ref:`escape sequences <escape-sequences>` supported by Python string literals are also accepted by the regular expression parser::
\a \b \f \n
\N \r \t \u
\U \v \x \\ | trusted_official_docs | CPython Docs | Most of the :ref:`escape sequences <escape-sequences>` supported by Python string literals are also accepted by the regular expression parser::
\a \b \f \n
\N \r \t \u
\U \v \x \\ | Most of the :ref:`escape sequences <escape-sequences>` supported by Python string literals are also accepted by the regular expression parser::
\a \b \f \n
\N \r \t \u
\U \v \x \\ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8551c2f4-8eeb-48fe-8e19-93044acb5603 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,266 | supabase-export-v2 | 758fc81a336e9ded | languages and regular expression implementations is to use the term *match* to refer to the behavior of what Python has always called :meth:`~Pattern.search`. See :ref:`prefixmatch-vs-match`.
.. method:: Pattern.fullmatch(string[, pos[, endpos]]) | trusted_official_docs | CPython Docs | languages and regular expression implementations is to use the term *match* to refer to the behavior of what Python has always called :meth:`~Pattern.search`. See :ref:`prefixmatch-vs-match`.
.. method:: Pattern.fullmatch(string[, pos[, endpos]]) | languages and regular expression implementations is to use the term *match* to refer to the behavior of what Python has always called :meth:`~Pattern.search`. See :ref:`prefixmatch-vs-match`.
.. method:: Pattern.fullmatch(string[, pos[, endpos]]) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8602b29b-a87f-4731-bbb8-fdcf936aba39 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,199 | supabase-export-v2 | f490429679955b3c | the RE *pattern* in *string*. The *string* is scanned left-to-right, and matches are returned in the order found. Empty matches are included in the result.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operato... | trusted_official_docs | CPython Docs | the RE *pattern* in *string*. The *string* is scanned left-to-right, and matches are returned in the order found. Empty matches are included in the result.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operato... | the RE *pattern* in *string*. The *string* is scanned left-to-right, and matches are returned in the order found. Empty matches are included in the result.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operato... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
86724af8-6e76-4196-9102-ca80d75fbd4d | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,220 | supabase-export-v2 | 1fd7f718956d2f91 | Perform the same operation as :func:`sub`, but return a tuple ``(new_string, number_of_subs_made)``.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | trusted_official_docs | CPython Docs | Perform the same operation as :func:`sub`, but return a tuple ``(new_string, number_of_subs_made)``.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | Perform the same operation as :func:`sub`, but return a tuple ``(new_string, number_of_subs_made)``.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operator). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
87288061-0174-4fea-9054-439ec02acc9d | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,067 | supabase-export-v2 | 624944731e9d63e4 | underscore, although this can be changed by using the :py:const:`~re.ASCII` flag. Word boundaries are determined by the current locale if the :py:const:`~re.LOCALE` flag is used.
.. versionchanged:: 3.14
``\B`` now matches empty input string. | trusted_official_docs | CPython Docs | underscore, although this can be changed by using the :py:const:`~re.ASCII` flag. Word boundaries are determined by the current locale if the :py:const:`~re.LOCALE` flag is used.
.. versionchanged:: 3.14
``\B`` now matches empty input string. | underscore, although this can be changed by using the :py:const:`~re.ASCII` flag. Word boundaries are determined by the current locale if the :py:const:`~re.LOCALE` flag is used.
.. versionchanged:: 3.14
``\B`` now matches empty input string. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8795f74a-9951-49af-a931-efa077b36d30 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,147 | supabase-export-v2 | 7a7d1bd9c07028e2 | character class and is not preceded by an unescaped backslash, all characters from the leftmost such ``#`` through the end of the line are ignored.
This means that the two following regular expression objects that match a
decimal number are functionally equal:: | trusted_official_docs | CPython Docs | character class and is not preceded by an unescaped backslash, all characters from the leftmost such ``#`` through the end of the line are ignored.
This means that the two following regular expression objects that match a
decimal number are functionally equal:: | character class and is not preceded by an unescaped backslash, all characters from the leftmost such ``#`` through the end of the line are ignored.
This means that the two following regular expression objects that match a
decimal number are functionally equal:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
87dc90fd-0bec-4d18-ac57-aead90eeff40 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,320 | supabase-export-v2 | 9a96e3797edd05ce | and everything after it optional, not all groups might participate in the match. These groups will default to ``None`` unless the *default* argument is given::
>>> m = re.search(r"(\d+)\.?(\d+)?", "24")
>>> m.groups() # Second group defaults to None. ('24', None)
>>> m.groups('0') # Now, the second group defaults to ... | trusted_official_docs | CPython Docs | and everything after it optional, not all groups might participate in the match. These groups will default to ``None`` unless the *default* argument is given::
>>> m = re.search(r"(\d+)\.?(\d+)?", "24")
>>> m.groups() # Second group defaults to None. ('24', None)
>>> m.groups('0') # Now, the second group defaults to ... | and everything after it optional, not all groups might participate in the match. These groups will default to ``None`` unless the *default* argument is given::
>>> m = re.search(r"(\d+)\.?(\d+)?", "24")
>>> m.groups() # Second group defaults to None. ('24', None)
>>> m.groups('0') # Now, the second group defaults to ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8811ec8b-4a01-42f1-b0eb-fa077e92f6d8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,410 | supabase-export-v2 | 3665a1cdcc27572a | Finding all adverbs and their positions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If one wants more information about all matches of a pattern than the matched
text, :func:`finditer` is useful as it provides :class:`~re.Match` objects
instead of strings. Continuing with the previous example, if a writer wanted
to find al... | trusted_official_docs | CPython Docs | Finding all adverbs and their positions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If one wants more information about all matches of a pattern than the matched
text, :func:`finditer` is useful as it provides :class:`~re.Match` objects
instead of strings. Continuing with the previous example, if a writer wanted
to find al... | Finding all adverbs and their positions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If one wants more information about all matches of a pattern than the matched
text, :func:`finditer` is useful as it provides :class:`~re.Match` objects
instead of strings. Continuing with the previous example, if a writer wanted
to find al... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d42ad29-24bf-443e-be63-14df6c0a5fe5 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,962 | supabase-export-v2 | 4e44648262f3487a | a particular string matches a given regular expression (or if a given regular expression matches a particular string, which comes down to the same thing).
Regular expressions can be concatenated to form new regular expressions; if *A*
and *B* are both regular expressions, then *AB* is also a regular expression. In gene... | trusted_official_docs | CPython Docs | a particular string matches a given regular expression (or if a given regular expression matches a particular string, which comes down to the same thing).
Regular expressions can be concatenated to form new regular expressions; if *A*
and *B* are both regular expressions, then *AB* is also a regular expression. In gene... | a particular string matches a given regular expression (or if a given regular expression matches a particular string, which comes down to the same thing).
Regular expressions can be concatenated to form new regular expressions; if *A*
and *B* are both regular expressions, then *AB* is also a regular expression. In gene... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8d9ec809-58e5-41b7-8a56-fb6886f1fd4e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,195 | supabase-export-v2 | 78994f199e2984f5 | >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') ['foot', 'fell', 'fastest'] >>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10') [('width', '20'), ('height', '10')]
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined usi... | trusted_official_docs | CPython Docs | >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') ['foot', 'fell', 'fastest'] >>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10') [('width', '20'), ('height', '10')]
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined usi... | >>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest') ['foot', 'fell', 'fastest'] >>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10') [('width', '20'), ('height', '10')]
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined usi... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8dd99fa1-4214-491f-8443-d2aca0042158 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,274 | supabase-export-v2 | 87396f10d4dba245 | .. method:: Pattern.findall(string[, pos[, endpos]])
Similar to the :func:`findall` function, using the compiled pattern, but
also accepts optional *pos* and *endpos* parameters that limit the search
region like for :meth:`search`. | trusted_official_docs | CPython Docs | .. method:: Pattern.findall(string[, pos[, endpos]])
Similar to the :func:`findall` function, using the compiled pattern, but
also accepts optional *pos* and *endpos* parameters that limit the search
region like for :meth:`search`. | .. method:: Pattern.findall(string[, pos[, endpos]])
Similar to the :func:`findall` function, using the compiled pattern, but
also accepts optional *pos* and *endpos* parameters that limit the search
region like for :meth:`search`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8f5f8af6-3a97-4977-a34a-aadb80138a1a | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,973 | supabase-export-v2 | a3e60df2623e1118 | .. index:: single: $ (dollar); in regular expressions
``$``
Matches the end of the string or just before the newline at the end of the
string, and in :const:`MULTILINE` mode also matches before a newline. ``foo``
matches both 'foo' and 'foobar', while the regular expression ``foo$`` matches
only 'foo'. More interes... | trusted_official_docs | CPython Docs | .. index:: single: $ (dollar); in regular expressions
``$``
Matches the end of the string or just before the newline at the end of the
string, and in :const:`MULTILINE` mode also matches before a newline. ``foo``
matches both 'foo' and 'foobar', while the regular expression ``foo$`` matches
only 'foo'. More interes... | .. index:: single: $ (dollar); in regular expressions
``$``
Matches the end of the string or just before the newline at the end of the
string, and in :const:`MULTILINE` mode also matches before a newline. ``foo``
matches both 'foo' and 'foobar', while the regular expression ``foo$`` matches
only 'foo'. More interes... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9042b794-e2b2-4ac0-a16d-a7e1b95f73ff | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,422 | supabase-export-v2 | 1a0b0c422f1c0b69 | class Token(NamedTuple): type: str value: int | float | str line: int column: int
def tokenize(code):
keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}
token_specification = [
('NUMBER', r'\d+(\.\d*)?'), # Integer or decimal number
('ASSIGN', r':='), # Assignment operator
('END', r';'), # Statem... | trusted_official_docs | CPython Docs | class Token(NamedTuple): type: str value: int | float | str line: int column: int
def tokenize(code):
keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}
token_specification = [
('NUMBER', r'\d+(\.\d*)?'), # Integer or decimal number
('ASSIGN', r':='), # Assignment operator
('END', r';'), # Statem... | class Token(NamedTuple): type: str value: int | float | str line: int column: int
def tokenize(code):
keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}
token_specification = [
('NUMBER', r'\d+(\.\d*)?'), # Integer or decimal number
('ASSIGN', r':='), # Assignment operator
('END', r';'), # Statem... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9043a1ce-3bb4-4c54-8679-c0a5167adf3c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,116 | supabase-export-v2 | cb93404eff548d2c | .. note::
The :py:const:`~re.U` flag still exists for backward compatibility,
but is redundant in Python 3 since
matches are Unicode by default for ``str`` patterns,
and Unicode matching isn't allowed for bytes patterns. :py:const:`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant. | trusted_official_docs | CPython Docs | .. note::
The :py:const:`~re.U` flag still exists for backward compatibility,
but is redundant in Python 3 since
matches are Unicode by default for ``str`` patterns,
and Unicode matching isn't allowed for bytes patterns. :py:const:`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant. | .. note::
The :py:const:`~re.U` flag still exists for backward compatibility,
but is redundant in Python 3 since
matches are Unicode by default for ``str`` patterns,
and Unicode matching isn't allowed for bytes patterns. :py:const:`~re.UNICODE` and the inline flag ``(?u)`` are similarly redundant. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
92963f5d-a26d-4498-8d90-4ee795cffeee | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,982 | supabase-export-v2 | 6b7fbc0f70ed6072 | it perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few* characters as possible will be matched. Using the RE ``<.*?>`` will match only ``'<a>'``.
.. index::
single: *+; in regular expressions
single: ++; in regular expressions
single: ?+; in regular expressions | trusted_official_docs | CPython Docs | it perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few* characters as possible will be matched. Using the RE ``<.*?>`` will match only ``'<a>'``.
.. index::
single: *+; in regular expressions
single: ++; in regular expressions
single: ?+; in regular expressions | it perform the match in :dfn:`non-greedy` or :dfn:`minimal` fashion; as *few* characters as possible will be matched. Using the RE ``<.*?>`` will match only ``'<a>'``.
.. index::
single: *+; in regular expressions
single: ++; in regular expressions
single: ?+; in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
92eb6feb-37a5-411a-b884-1c4dc7788568 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,161 | supabase-export-v2 | bb8d4314f938f936 | and the module-level matching functions are cached, so programs that use only a few regular expressions at a time needn't worry about compiling regular expressions.
.. function:: search(pattern, string, flags=0) | trusted_official_docs | CPython Docs | and the module-level matching functions are cached, so programs that use only a few regular expressions at a time needn't worry about compiling regular expressions.
.. function:: search(pattern, string, flags=0) | and the module-level matching functions are cached, so programs that use only a few regular expressions at a time needn't worry about compiling regular expressions.
.. function:: search(pattern, string, flags=0) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
93d775fb-ee05-4ba1-be57-fd4016c0cc1c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,055 | supabase-export-v2 | 435675f0daff2df5 | .. _re-special-sequences:
The special sequences consist of ``'\'`` and a character from the list below. If the ordinary character is not an ASCII digit or an ASCII letter, then the
resulting RE will match the second character. For example, ``\$`` matches the
character ``'$'``. | trusted_official_docs | CPython Docs | .. _re-special-sequences:
The special sequences consist of ``'\'`` and a character from the list below. If the ordinary character is not an ASCII digit or an ASCII letter, then the
resulting RE will match the second character. For example, ``\$`` matches the
character ``'$'``. | .. _re-special-sequences:
The special sequences consist of ``'\'`` and a character from the list below. If the ordinary character is not an ASCII digit or an ASCII letter, then the
resulting RE will match the second character. For example, ``\$`` matches the
character ``'$'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
96f03c90-a114-457d-92b0-0b2bffa386b4 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,981 | supabase-export-v2 | a7acbbd981fa940b | .. index:: single: *?; in regular expressions single: +?; in regular expressions single: ??; in regular expressions
``*?``, ``+?``, ``??``
The ``'*'``, ``'+'``, and ``'?'`` quantifiers are all :dfn:`greedy`; they match
as much text as possible. Sometimes this behaviour isn't desired; if the RE
``<.*>`` is matched ag... | trusted_official_docs | CPython Docs | .. index:: single: *?; in regular expressions single: +?; in regular expressions single: ??; in regular expressions
``*?``, ``+?``, ``??``
The ``'*'``, ``'+'``, and ``'?'`` quantifiers are all :dfn:`greedy`; they match
as much text as possible. Sometimes this behaviour isn't desired; if the RE
``<.*>`` is matched ag... | .. index:: single: *?; in regular expressions single: +?; in regular expressions single: ??; in regular expressions
``*?``, ``+?``, ``??``
The ``'*'``, ``'+'``, and ``'?'`` quantifiers are all :dfn:`greedy`; they match
as much text as possible. Sometimes this behaviour isn't desired; if the RE
``<.*>`` is matched ag... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
975519c7-f265-4d28-a10d-f6013b7393c6 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,989 | supabase-export-v2 | 6b0b6a03261f4de2 | characters followed by a ``'b'``, but not ``'aaab'``. The comma may not be omitted or the modifier would be confused with the previously described form.
``{m,n}?``
Causes the resulting RE to match from *m* to *n* repetitions of the preceding
RE, attempting to match as *few* repetitions as possible. This is the
non-g... | trusted_official_docs | CPython Docs | characters followed by a ``'b'``, but not ``'aaab'``. The comma may not be omitted or the modifier would be confused with the previously described form.
``{m,n}?``
Causes the resulting RE to match from *m* to *n* repetitions of the preceding
RE, attempting to match as *few* repetitions as possible. This is the
non-g... | characters followed by a ``'b'``, but not ``'aaab'``. The comma may not be omitted or the modifier would be confused with the previously described form.
``{m,n}?``
Causes the resulting RE to match from *m* to *n* repetitions of the preceding
RE, attempting to match as *few* repetitions as possible. This is the
non-g... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
980cf419-8761-4353-8b55-14782482ba5a | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,122 | supabase-export-v2 | df49f1ceb1f85349 | flag is used to disable non-ASCII matches. The current locale does not change the effect of this flag unless the :py:const:`~re.LOCALE` flag is also used.
Corresponds to the inline flag ``(?i)``. | trusted_official_docs | CPython Docs | flag is used to disable non-ASCII matches. The current locale does not change the effect of this flag unless the :py:const:`~re.LOCALE` flag is also used.
Corresponds to the inline flag ``(?i)``. | flag is used to disable non-ASCII matches. The current locale does not change the effect of this flag unless the :py:const:`~re.LOCALE` flag is also used.
Corresponds to the inline flag ``(?i)``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
98b576e9-da99-4f07-9cb8-cb82f3630918 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,995 | supabase-export-v2 | 51acbe62b33d4f62 | be repeated twice. This is complicated and hard to understand, so it's highly recommended that you use raw strings for all but the simplest expressions.
.. index::
single: [] (square brackets); in regular expressions | trusted_official_docs | CPython Docs | be repeated twice. This is complicated and hard to understand, so it's highly recommended that you use raw strings for all but the simplest expressions.
.. index::
single: [] (square brackets); in regular expressions | be repeated twice. This is complicated and hard to understand, so it's highly recommended that you use raw strings for all but the simplest expressions.
.. index::
single: [] (square brackets); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9acbd372-d05b-481c-befb-f4c878917ba4 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,132 | supabase-export-v2 | 5ac52ee69b8e296e | .. data:: M MULTILINE
When specified, the pattern character ``'^'`` matches at the beginning of the
string and at the beginning of each line (immediately following each newline);
and the pattern character ``'$'`` matches at the end of the string and at the
end of each line (immediately preceding each newline). By de... | trusted_official_docs | CPython Docs | .. data:: M MULTILINE
When specified, the pattern character ``'^'`` matches at the beginning of the
string and at the beginning of each line (immediately following each newline);
and the pattern character ``'$'`` matches at the end of the string and at the
end of each line (immediately preceding each newline). By de... | .. data:: M MULTILINE
When specified, the pattern character ``'^'`` matches at the beginning of the
string and at the beginning of each line (immediately following each newline);
and the pattern character ``'$'`` matches at the end of the string and at the
end of each line (immediately preceding each newline). By de... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9af3130f-6c0e-4f71-96fe-47b6a77a1b08 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,013 | supabase-export-v2 | 44aba70cfb8288d0 | .. index:: single: () (parentheses); in regular expressions
``(...)``
Matches whatever regular expression is inside the parentheses, and indicates the
start and end of a group; the contents of a group can be retrieved after a match
has been performed, and can be matched later in the string with the ``\number``
spec... | trusted_official_docs | CPython Docs | .. index:: single: () (parentheses); in regular expressions
``(...)``
Matches whatever regular expression is inside the parentheses, and indicates the
start and end of a group; the contents of a group can be retrieved after a match
has been performed, and can be matched later in the string with the ``\number``
spec... | .. index:: single: () (parentheses); in regular expressions
``(...)``
Matches whatever regular expression is inside the parentheses, and indicates the
start and end of a group; the contents of a group can be retrieved after a match
has been performed, and can be matched later in the string with the ``\number``
spec... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9bd4bd84-c46d-426a-8ec3-0ef71ea9a518 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,168 | supabase-export-v2 | 8e933da2d36598c8 | Even in :const:`MULTILINE` mode, this will only match at the beginning of the string and not at the beginning of each line.
If you want to locate a match anywhere in *string*, use :func:`search`
instead (see also :ref:`search-vs-match`). | trusted_official_docs | CPython Docs | Even in :const:`MULTILINE` mode, this will only match at the beginning of the string and not at the beginning of each line.
If you want to locate a match anywhere in *string*, use :func:`search`
instead (see also :ref:`search-vs-match`). | Even in :const:`MULTILINE` mode, this will only match at the beginning of the string and not at the beginning of each line.
If you want to locate a match anywhere in *string*, use :func:`search`
instead (see also :ref:`search-vs-match`). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9cf13c70-0972-4343-9cd8-0288a759e72c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,416 | supabase-export-v2 | 3fddb10328861d97 | regular expression. With raw string notation, this means ``r"\\"``. Without raw string notation, one must use ``"\\\\"``, making the following lines of code functionally identical::
>>> re.search(r"\\", r"\\")
<re.Match object; span=(0, 1), match='\\'>
>>> re.search("\\\\", r"\\")
<re.Match object; span=(0, 1), matc... | trusted_official_docs | CPython Docs | regular expression. With raw string notation, this means ``r"\\"``. Without raw string notation, one must use ``"\\\\"``, making the following lines of code functionally identical::
>>> re.search(r"\\", r"\\")
<re.Match object; span=(0, 1), match='\\'>
>>> re.search("\\\\", r"\\")
<re.Match object; span=(0, 1), matc... | regular expression. With raw string notation, this means ``r"\\"``. Without raw string notation, one must use ``"\\\\"``, making the following lines of code functionally identical::
>>> re.search(r"\\", r"\\")
<re.Match object; span=(0, 1), match='\\'>
>>> re.search("\\\\", r"\\")
<re.Match object; span=(0, 1), matc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9ded1e80-c52c-42bf-b035-eeeef6cf844a | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,211 | supabase-export-v2 | 920934d860c0c304 | 20, not a reference to group 2 followed by the literal character ``'0'``. The backreference ``\g<0>`` substitutes in the entire substring matched by the RE.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operat... | trusted_official_docs | CPython Docs | 20, not a reference to group 2 followed by the literal character ``'0'``. The backreference ``\g<0>`` substitutes in the entire substring matched by the RE.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operat... | 20, not a reference to group 2 followed by the literal character ``'0'``. The backreference ``\g<0>`` substitutes in the entire substring matched by the RE.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags`_ variables, combined using bitwise OR
(the ``|`` operat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f583751-7c82-4b65-8fa5-5d8256f0ba8e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,096 | supabase-export-v2 | cfa386ebf25deb6d | single: \u; in regular expressions single: \U; in regular expressions single: \v; in regular expressions single: \x; in regular expressions single: \\; in regular expressions
Most of the :ref:`escape sequences <escape-sequences>` supported by Python
string literals are also accepted by the regular expression parser:: | trusted_official_docs | CPython Docs | single: \u; in regular expressions single: \U; in regular expressions single: \v; in regular expressions single: \x; in regular expressions single: \\; in regular expressions
Most of the :ref:`escape sequences <escape-sequences>` supported by Python
string literals are also accepted by the regular expression parser:: | single: \u; in regular expressions single: \U; in regular expressions single: \v; in regular expressions single: \x; in regular expressions single: \\; in regular expressions
Most of the :ref:`escape sequences <escape-sequences>` supported by Python
string literals are also accepted by the regular expression parser:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a00f6e7c-5d3b-45f0-bde8-2467862b2af8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,979 | supabase-export-v2 | fc4c88e9af56ddbc | .. index:: single: ? (question mark); in regular expressions
``?``
Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'. | trusted_official_docs | CPython Docs | .. index:: single: ? (question mark); in regular expressions
``?``
Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'. | .. index:: single: ? (question mark); in regular expressions
``?``
Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0208cd1-40c7-435f-be8c-3bf0e6d75a7e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,350 | supabase-export-v2 | 2ea7901da05f89d1 | def displaymatch(match): if match is None: return None return '<Match: %r, groups=%r>' % (match.group(), match.groups())
Suppose you are writing a poker program where a player's hand is represented as
a 5-character string with each character representing a card, "a" for ace, "k"
for king, "q" for queen, "j" for jack, "... | trusted_official_docs | CPython Docs | def displaymatch(match): if match is None: return None return '<Match: %r, groups=%r>' % (match.group(), match.groups())
Suppose you are writing a poker program where a player's hand is represented as
a 5-character string with each character representing a card, "a" for ace, "k"
for king, "q" for queen, "j" for jack, "... | def displaymatch(match): if match is None: return None return '<Match: %r, groups=%r>' % (match.group(), match.groups())
Suppose you are writing a poker program where a player's hand is represented as
a 5-character string with each character representing a card, "a" for ace, "k"
for king, "q" for queen, "j" for jack, "... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a0afca74-6d4b-4b7c-b131-2a843614c997 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,123 | supabase-export-v2 | 81c11caeded04a58 | Corresponds to the inline flag ``(?i)``.
Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in
combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII
letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital
letter I with dot above), 'ı' (U+0131, Latin small letter ... | trusted_official_docs | CPython Docs | Corresponds to the inline flag ``(?i)``.
Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in
combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII
letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital
letter I with dot above), 'ı' (U+0131, Latin small letter ... | Corresponds to the inline flag ``(?i)``.
Note that when the Unicode patterns ``[a-z]`` or ``[A-Z]`` are used in
combination with the :const:`IGNORECASE` flag, they will match the 52 ASCII
letters and 4 additional non-ASCII letters: 'İ' (U+0130, Latin capital
letter I with dot above), 'ı' (U+0131, Latin small letter ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a62dfb6f-eb34-429d-8a16-ab6aadc50695 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,175 | supabase-export-v2 | 129aaaf6447b6b6b | .. function:: fullmatch(pattern, string, flags=0)
If the whole *string* matches the regular expression *pattern*, return a
corresponding :class:`~re.Match`. Return ``None`` if the string does not match
the pattern; note that this is different from a zero-length match. | trusted_official_docs | CPython Docs | .. function:: fullmatch(pattern, string, flags=0)
If the whole *string* matches the regular expression *pattern*, return a
corresponding :class:`~re.Match`. Return ``None`` if the string does not match
the pattern; note that this is different from a zero-length match. | .. function:: fullmatch(pattern, string, flags=0)
If the whole *string* matches the regular expression *pattern*, return a
corresponding :class:`~re.Match`. Return ``None`` if the string does not match
the pattern; note that this is different from a zero-length match. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6c84693-8c93-4174-834f-b125c704d6d9 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,363 | supabase-export-v2 | f02b46762e354909 | | ``%o`` | ``[-+]?[0-7]+`` | +--------------------------------+---------------------------------------------+ | ``%s`` | ``\S+`` | +--------------------------------+---------------------------------------------+ | ``%u`` | ``\d+`` | +--------------------------------+---------------------------------------------+ | ``%x... | trusted_official_docs | CPython Docs | | ``%o`` | ``[-+]?[0-7]+`` | +--------------------------------+---------------------------------------------+ | ``%s`` | ``\S+`` | +--------------------------------+---------------------------------------------+ | ``%u`` | ``\d+`` | +--------------------------------+---------------------------------------------+ | ``%x... | | ``%o`` | ``[-+]?[0-7]+`` | +--------------------------------+---------------------------------------------+ | ``%s`` | ``\S+`` | +--------------------------------+---------------------------------------------+ | ``%u`` | ``\d+`` | +--------------------------------+---------------------------------------------+ | ``%x... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6c86d7e-f2e7-429f-81c9-168175c44794 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,194 | supabase-export-v2 | 69045f0afc275e57 | If multiple groups are present, return a list of tuples of strings matching the groups. Non-capturing groups do not affect the form of the result.
>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
>>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10')
[('width', '20'),... | trusted_official_docs | CPython Docs | If multiple groups are present, return a list of tuples of strings matching the groups. Non-capturing groups do not affect the form of the result.
>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
>>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10')
[('width', '20'),... | If multiple groups are present, return a list of tuples of strings matching the groups. Non-capturing groups do not affect the form of the result.
>>> re.findall(r'\bf[a-z]*', 'which foot or hand fell fastest')
['foot', 'fell', 'fastest']
>>> re.findall(r'(\w+)=(\d+)', 'set width=20 and height=10')
[('width', '20'),... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a8f2bff0-637b-469c-8946-5c3c16114fb6 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,128 | supabase-export-v2 | 993277034e6cdd4d | .. warning::
This flag is discouraged; consider Unicode matching instead. The locale mechanism is very unreliable
as it only handles one "culture" at a time
and only works with 8-bit locales. Unicode matching is enabled by default for Unicode (str) patterns
and it is able to handle different locales and languages. | trusted_official_docs | CPython Docs | .. warning::
This flag is discouraged; consider Unicode matching instead. The locale mechanism is very unreliable
as it only handles one "culture" at a time
and only works with 8-bit locales. Unicode matching is enabled by default for Unicode (str) patterns
and it is able to handle different locales and languages. | .. warning::
This flag is discouraged; consider Unicode matching instead. The locale mechanism is very unreliable
as it only handles one "culture" at a time
and only works with 8-bit locales. Unicode matching is enabled by default for Unicode (str) patterns
and it is able to handle different locales and languages. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a993eabf-fb20-4af2-8377-3ff2ed6f8ee0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,969 | supabase-export-v2 | f3ee12ba400733c2 | .. index:: single: . (dot); in regular expressions
``.``
(Dot.) In the default mode, this matches any character except a newline. If
the :const:`DOTALL` flag has been specified, this matches any character
including a newline. ``(?s:.)`` matches any character regardless of flags. | trusted_official_docs | CPython Docs | .. index:: single: . (dot); in regular expressions
``.``
(Dot.) In the default mode, this matches any character except a newline. If
the :const:`DOTALL` flag has been specified, this matches any character
including a newline. ``(?s:.)`` matches any character regardless of flags. | .. index:: single: . (dot); in regular expressions
``.``
(Dot.) In the default mode, this matches any character except a newline. If
the :const:`DOTALL` flag has been specified, this matches any character
including a newline. ``(?s:.)`` matches any character regardless of flags. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
abac9450-b8e7-42d4-afdc-cd57d895a20d | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,100 | supabase-export-v2 | 99807a7f98337893 | recognized in Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes of ASCII letters are reserved for future use and treated as errors.
Octal escapes are included in a limited form. If the first digit is a 0, or if
there are three octal digits, it is considered an octal escape. Otherwise, it is
a g... | trusted_official_docs | CPython Docs | recognized in Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes of ASCII letters are reserved for future use and treated as errors.
Octal escapes are included in a limited form. If the first digit is a 0, or if
there are three octal digits, it is considered an octal escape. Otherwise, it is
a g... | recognized in Unicode (str) patterns. In bytes patterns they are errors. Unknown escapes of ASCII letters are reserved for future use and treated as errors.
Octal escapes are included in a limited form. If the first digit is a 0, or if
there are three octal digits, it is considered an octal escape. Otherwise, it is
a g... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ad59399f-f205-4d6a-97d6-def23d168f72 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,980 | supabase-export-v2 | fc6e6f4550a06e7d | ``?`` Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'.
.. index::
single: *?; in regular expressions
single: +?; in regular expressions
single: ??; in regular expressions | trusted_official_docs | CPython Docs | ``?`` Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'.
.. index::
single: *?; in regular expressions
single: +?; in regular expressions
single: ??; in regular expressions | ``?`` Causes the resulting RE to match 0 or 1 repetitions of the preceding RE. ``ab?`` will match either 'a' or 'ab'.
.. index::
single: *?; in regular expressions
single: +?; in regular expressions
single: ??; in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aea844c8-4327-4b0a-a476-f014f22fd026 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,052 | supabase-export-v2 | 9a094dc659977599 | .. _re-conditional-expression: .. index:: single: (?(; in regular expressions
``(?(id/name)yes-pattern|no-pattern)``
Will try to match with ``yes-pattern`` if the group with given *id* or
*name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is
optional and can be omitted. For example,
``(<)?(\w+@\w+... | trusted_official_docs | CPython Docs | .. _re-conditional-expression: .. index:: single: (?(; in regular expressions
``(?(id/name)yes-pattern|no-pattern)``
Will try to match with ``yes-pattern`` if the group with given *id* or
*name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is
optional and can be omitted. For example,
``(<)?(\w+@\w+... | .. _re-conditional-expression: .. index:: single: (?(; in regular expressions
``(?(id/name)yes-pattern|no-pattern)``
Will try to match with ``yes-pattern`` if the group with given *id* or
*name* exists, and with ``no-pattern`` if it doesn't. ``no-pattern`` is
optional and can be omitted. For example,
``(<)?(\w+@\w+... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b013fd7b-bddc-4aee-b562-d732bd1df3cd | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,975 | supabase-export-v2 | 2df2dbcbddc0403d | .. index:: single: * (asterisk); in regular expressions
``*``
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as
many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed
by any number of 'b's. | trusted_official_docs | CPython Docs | .. index:: single: * (asterisk); in regular expressions
``*``
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as
many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed
by any number of 'b's. | .. index:: single: * (asterisk); in regular expressions
``*``
Causes the resulting RE to match 0 or more repetitions of the preceding RE, as
many repetitions as are possible. ``ab*`` will match 'a', 'ab', or 'a' followed
by any number of 'b's. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b04bbb54-c76b-4d24-bd48-823630999eae | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,148 | supabase-export-v2 | 0224bbdeae2818c0 | This means that the two following regular expression objects that match a decimal number are functionally equal::
a = re.compile(r"""\d + # the integral part
\. # the decimal point
\d * # some fractional digits""", re.X)
b = re.compile(r"\d+\.\d*") | trusted_official_docs | CPython Docs | This means that the two following regular expression objects that match a decimal number are functionally equal::
a = re.compile(r"""\d + # the integral part
\. # the decimal point
\d * # some fractional digits""", re.X)
b = re.compile(r"\d+\.\d*") | This means that the two following regular expression objects that match a decimal number are functionally equal::
a = re.compile(r"""\d + # the integral part
\. # the decimal point
\d * # some fractional digits""", re.X)
b = re.compile(r"\d+\.\d*") | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b0f5abb9-2286-4ad3-a9fc-878374d06153 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,135 | supabase-export-v2 | 9b8f4cebf12e14af | .. data:: NOFLAG
Indicates no flag being applied, the value is ``0``. This flag may be used
as a default value for a function keyword argument or as a base value that
will be conditionally ORed with other flags. Example of use as a default
value:: | trusted_official_docs | CPython Docs | .. data:: NOFLAG
Indicates no flag being applied, the value is ``0``. This flag may be used
as a default value for a function keyword argument or as a base value that
will be conditionally ORed with other flags. Example of use as a default
value:: | .. data:: NOFLAG
Indicates no flag being applied, the value is ``0``. This flag may be used
as a default value for a function keyword argument or as a base value that
will be conditionally ORed with other flags. Example of use as a default
value:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b10d4734-01c5-4cf3-8e29-7b2104bb9b97 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,103 | supabase-export-v2 | 15b64b72ce237679 | .. versionchanged:: 3.6 Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors.
.. versionchanged:: 3.8
The :samp:`'\\N\\{{name}\\}'` escape sequence has been added. As in string literals,
it expands to the named Unicode character (e.g. ``'\N{EM DASH}'``). | trusted_official_docs | CPython Docs | .. versionchanged:: 3.6 Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors.
.. versionchanged:: 3.8
The :samp:`'\\N\\{{name}\\}'` escape sequence has been added. As in string literals,
it expands to the named Unicode character (e.g. ``'\N{EM DASH}'``). | .. versionchanged:: 3.6 Unknown escapes consisting of ``'\'`` and an ASCII letter now are errors.
.. versionchanged:: 3.8
The :samp:`'\\N\\{{name}\\}'` escape sequence has been added. As in string literals,
it expands to the named Unicode character (e.g. ``'\N{EM DASH}'``). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b12bcca9-4626-4c11-bffd-014aa813cd47 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,268 | supabase-export-v2 | 34bf7145721fe17c | regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`~Pattern.search` method. :: | trusted_official_docs | CPython Docs | regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`~Pattern.search` method. :: | regular expression, return a corresponding :class:`~re.Match`. Return ``None`` if the string does not match the pattern; note that this is different from a zero-length match.
The optional *pos* and *endpos* parameters have the same meaning as for the
:meth:`~Pattern.search` method. :: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b18eade7-76cb-42cf-bc80-84d043fc5a24 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,961 | supabase-export-v2 | d9e9c5ba714a1ff7 | Regular expression syntax -------------------------
A regular expression (or RE) specifies a set of strings that matches it; the
functions in this module let you check if a particular string matches a given
regular expression (or if a given regular expression matches a particular
string, which comes down to the same th... | trusted_official_docs | CPython Docs | Regular expression syntax -------------------------
A regular expression (or RE) specifies a set of strings that matches it; the
functions in this module let you check if a particular string matches a given
regular expression (or if a given regular expression matches a particular
string, which comes down to the same th... | Regular expression syntax -------------------------
A regular expression (or RE) specifies a set of strings that matches it; the
functions in this module let you check if a particular string matches a given
regular expression (or if a given regular expression matches a particular
string, which comes down to the same th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b26a0aa8-ef6b-4e29-b807-d36e8ff780a7 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,031 | supabase-export-v2 | 53d8a115be47d79c | .. index:: single: (?P<; in regular expressions
``(?P<name>...)``
Similar to regular parentheses, but the substring matched by the group is
accessible via the symbolic group name *name*. Group names must be valid
Python identifiers, and in :class:`bytes` patterns they can only contain
bytes in the ASCII range. Each... | trusted_official_docs | CPython Docs | .. index:: single: (?P<; in regular expressions
``(?P<name>...)``
Similar to regular parentheses, but the substring matched by the group is
accessible via the symbolic group name *name*. Group names must be valid
Python identifiers, and in :class:`bytes` patterns they can only contain
bytes in the ASCII range. Each... | .. index:: single: (?P<; in regular expressions
``(?P<name>...)``
Similar to regular parentheses, but the substring matched by the group is
accessible via the symbolic group name *name*. Group names must be valid
Python identifiers, and in :class:`bytes` patterns they can only contain
bytes in the ASCII range. Each... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b3264131-02d5-46f3-9162-c3c26e5ce113 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,216 | supabase-export-v2 | 1b5361f4da3c5af7 | 3.7 Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter now are errors. An empty match can occur immediately after a non-empty match.
.. versionchanged:: 3.12
Group *id* can only contain ASCII digits. In :class:`bytes` replacement strings, group *name* can only contain bytes
in the ASCII range (``b'\x... | trusted_official_docs | CPython Docs | 3.7 Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter now are errors. An empty match can occur immediately after a non-empty match.
.. versionchanged:: 3.12
Group *id* can only contain ASCII digits. In :class:`bytes` replacement strings, group *name* can only contain bytes
in the ASCII range (``b'\x... | 3.7 Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter now are errors. An empty match can occur immediately after a non-empty match.
.. versionchanged:: 3.12
Group *id* can only contain ASCII digits. In :class:`bytes` replacement strings, group *name* can only contain bytes
in the ASCII range (``b'\x... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b3953523-6cc5-4215-82ea-dcbdc488be24 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,349 | supabase-export-v2 | f9e43520fb8740c5 | In this example, we'll use the following helper function to display match objects a little more gracefully::
def displaymatch(match):
if match is None:
return None
return '<Match: %r, groups=%r>' % (match.group(), match.groups()) | trusted_official_docs | CPython Docs | In this example, we'll use the following helper function to display match objects a little more gracefully::
def displaymatch(match):
if match is None:
return None
return '<Match: %r, groups=%r>' % (match.group(), match.groups()) | In this example, we'll use the following helper function to display match objects a little more gracefully::
def displaymatch(match):
if match is None:
return None
return '<Match: %r, groups=%r>' % (match.group(), match.groups()) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b3c2f2b2-a017-4b9d-aa3f-4aae348883a5 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,146 | supabase-export-v2 | 9a8e8af0478d71dd | .. index:: single: # (hash); in regular expressions
This flag allows you to write regular expressions that look nicer and are
more readable by allowing you to visually separate logical sections of the
pattern and add comments. Whitespace within the pattern is ignored, except
when in a character class, or when preced... | trusted_official_docs | CPython Docs | .. index:: single: # (hash); in regular expressions
This flag allows you to write regular expressions that look nicer and are
more readable by allowing you to visually separate logical sections of the
pattern and add comments. Whitespace within the pattern is ignored, except
when in a character class, or when preced... | .. index:: single: # (hash); in regular expressions
This flag allows you to write regular expressions that look nicer and are
more readable by allowing you to visually separate logical sections of the
pattern and add comments. Whitespace within the pattern is ignored, except
when in a character class, or when preced... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b426b5a4-9a71-4ee1-89f9-d4ec063f3122 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,203 | supabase-export-v2 | 84e3c9a71fc0316b | escapes such as ``\&`` are left alone. Backreferences, such as ``\6``, are replaced with the substring matched by group 6 in the pattern. For example::
>>> re.sub(r'def\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\(\s*\):',
... r'static PyObject*\npy_\1(void)\n{',
... 'def myfunc():')
'static PyObject*\npy_myfunc(void)\n{' | trusted_official_docs | CPython Docs | escapes such as ``\&`` are left alone. Backreferences, such as ``\6``, are replaced with the substring matched by group 6 in the pattern. For example::
>>> re.sub(r'def\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\(\s*\):',
... r'static PyObject*\npy_\1(void)\n{',
... 'def myfunc():')
'static PyObject*\npy_myfunc(void)\n{' | escapes such as ``\&`` are left alone. Backreferences, such as ``\6``, are replaced with the substring matched by group 6 in the pattern. For example::
>>> re.sub(r'def\s+([a-zA-Z_][a-zA-Z_0-9]*)\s*\(\s*\):',
... r'static PyObject*\npy_\1(void)\n{',
... 'def myfunc():')
'static PyObject*\npy_myfunc(void)\n{' | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.