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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e2bd8ee1-3914-4cbf-835f-73d908603be8 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,887 | supabase-export-v2 | 9c9e46c7662ae502 | .. method:: update_visible()
When a :class:`!BabylMessage` instance's original headers are modified, the
visible headers are not automatically modified to correspond. This method
updates the visible headers as follows: each visible header with a
corresponding original header is set to the value of the original heade... | trusted_official_docs | CPython Docs | .. method:: update_visible()
When a :class:`!BabylMessage` instance's original headers are modified, the
visible headers are not automatically modified to correspond. This method
updates the visible headers as follows: each visible header with a
corresponding original header is set to the value of the original heade... | .. method:: update_visible()
When a :class:`!BabylMessage` instance's original headers are modified, the
visible headers are not automatically modified to correspond. This method
updates the visible headers as follows: each visible header with a
corresponding original header is set to the value of the original heade... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e32c6095-d46d-47ef-93c4-cce7e25b1a6b | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,778 | supabase-export-v2 | da67394ab6632324 | A subclass of the :mod:`email.message` module's :class:`~email.message.Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-specific state and behavior.
If *message* is omitted, the new instance is created in a default, empty state. If *message* is an :class:`email.message.Message` instance, its content... | trusted_official_docs | CPython Docs | A subclass of the :mod:`email.message` module's :class:`~email.message.Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-specific state and behavior.
If *message* is omitted, the new instance is created in a default, empty state. If *message* is an :class:`email.message.Message` instance, its content... | A subclass of the :mod:`email.message` module's :class:`~email.message.Message`. Subclasses of :class:`!mailbox.Message` add mailbox-format-specific state and behavior.
If *message* is omitted, the new instance is created in a default, empty state. If *message* is an :class:`email.message.Message` instance, its content... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5039b0d-905f-4ae8-8ff9-1b2d5c904b49 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,563 | supabase-export-v2 | 329e6b9116b3c4af | Replace the message corresponding to *key* with *message*. Raise a :exc:`KeyError` exception if no message already corresponds to *key*.
As with :meth:`add`, parameter *message* may be a :class:`Message`
instance, an :class:`email.message.Message` instance, a string, a byte
string, or a file-like object (which should... | trusted_official_docs | CPython Docs | Replace the message corresponding to *key* with *message*. Raise a :exc:`KeyError` exception if no message already corresponds to *key*.
As with :meth:`add`, parameter *message* may be a :class:`Message`
instance, an :class:`email.message.Message` instance, a string, a byte
string, or a file-like object (which should... | Replace the message corresponding to *key* with *message*. Raise a :exc:`KeyError` exception if no message already corresponds to *key*.
As with :meth:`add`, parameter *message* may be a :class:`Message`
instance, an :class:`email.message.Message` instance, a string, a byte
string, or a file-like object (which should... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e515b243-b99b-4c4b-8fe6-fa9568cbe803 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,738 | supabase-export-v2 | c68a2da5a1f085b5 | `nmh - Message Handling System <https://www.nongnu.org/nmh/>`_ Home page of :program:`nmh`, an updated version of the original :program:`mh`.
`MH & nmh: Email for Users & Programmers <https://rand-mh.sourceforge.io/book/>`_
A GPL-licensed book on :program:`mh` and :program:`nmh`, with some information
on the mailbox ... | trusted_official_docs | CPython Docs | `nmh - Message Handling System <https://www.nongnu.org/nmh/>`_ Home page of :program:`nmh`, an updated version of the original :program:`mh`.
`MH & nmh: Email for Users & Programmers <https://rand-mh.sourceforge.io/book/>`_
A GPL-licensed book on :program:`mh` and :program:`nmh`, with some information
on the mailbox ... | `nmh - Message Handling System <https://www.nongnu.org/nmh/>`_ Home page of :program:`nmh`, an updated version of the original :program:`mh`.
`MH & nmh: Email for Users & Programmers <https://rand-mh.sourceforge.io/book/>`_
A GPL-licensed book on :program:`mh` and :program:`nmh`, with some information
on the mailbox ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e5ea04c7-8433-4721-8460-bb937dcb4e0d | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,893 | supabase-export-v2 | bc550ec582d101f0 | When a :class:`!BabylMessage` instance is created based upon an :class:`MHMessage` instance, the following conversions take place:
+------------------+--------------------------+
| Resulting state | :class:`MHMessage` state |
+==================+==========================+
| "unseen" label | "unseen" sequence |
+------... | trusted_official_docs | CPython Docs | When a :class:`!BabylMessage` instance is created based upon an :class:`MHMessage` instance, the following conversions take place:
+------------------+--------------------------+
| Resulting state | :class:`MHMessage` state |
+==================+==========================+
| "unseen" label | "unseen" sequence |
+------... | When a :class:`!BabylMessage` instance is created based upon an :class:`MHMessage` instance, the following conversions take place:
+------------------+--------------------------+
| Resulting state | :class:`MHMessage` state |
+==================+==========================+
| "unseen" label | "unseen" sequence |
+------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e73eac33-3312-4d4d-8db8-297721fa66df | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,653 | supabase-export-v2 | a8d2c8a00a54c8d2 | .. method:: remove_flag(key, flag)
On the message corresponding to *key*, unset the flags specified
by *flag* without changing other flags. To remove more than one
flag at a time, *flag* may be a string of more than one character. | trusted_official_docs | CPython Docs | .. method:: remove_flag(key, flag)
On the message corresponding to *key*, unset the flags specified
by *flag* without changing other flags. To remove more than one
flag at a time, *flag* may be a string of more than one character. | .. method:: remove_flag(key, flag)
On the message corresponding to *key*, unset the flags specified
by *flag* without changing other flags. To remove more than one
flag at a time, *flag* may be a string of more than one character. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e77ed435-9a77-47ac-b00b-5084b8171d75 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,810 | supabase-export-v2 | b2b9be6ab2d7f8dd | Set "info" to *info*, which should be a string.
When a :class:`!MaildirMessage` instance is created based upon an
:class:`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status`
and :mailheader:`X-Status` headers are omitted and the following conversions
take place: | trusted_official_docs | CPython Docs | Set "info" to *info*, which should be a string.
When a :class:`!MaildirMessage` instance is created based upon an
:class:`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status`
and :mailheader:`X-Status` headers are omitted and the following conversions
take place: | Set "info" to *info*, which should be a string.
When a :class:`!MaildirMessage` instance is created based upon an
:class:`mboxMessage` or :class:`MMDFMessage` instance, the :mailheader:`Status`
and :mailheader:`X-Status` headers are omitted and the following conversions
take place: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
edee31e4-e8fc-42ed-b4cf-24ec52cfcf6e | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,932 | supabase-export-v2 | 4b32b6edce185434 | .. exception:: ExternalClashError()
Raised when some mailbox-related condition beyond the control of the program
causes it to be unable to proceed, such as when failing to acquire a lock that
another program already holds, or when a uniquely generated file name
already exists. | trusted_official_docs | CPython Docs | .. exception:: ExternalClashError()
Raised when some mailbox-related condition beyond the control of the program
causes it to be unable to proceed, such as when failing to acquire a lock that
another program already holds, or when a uniquely generated file name
already exists. | .. exception:: ExternalClashError()
Raised when some mailbox-related condition beyond the control of the program
causes it to be unable to proceed, such as when failing to acquire a lock that
another program already holds, or when a uniquely generated file name
already exists. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ef1b48eb-864f-4e29-9fed-23a747badf86 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,801 | supabase-export-v2 | e1b7634c2792c53f | .. method:: remove_flag(flag)
Unset the flag(s) specified by *flag* without changing other flags. To
remove more than one flag at a time, *flag* may be a string of more than
one character. If "info" contains experimental information rather than
flags, the current "info" is not modified. | trusted_official_docs | CPython Docs | .. method:: remove_flag(flag)
Unset the flag(s) specified by *flag* without changing other flags. To
remove more than one flag at a time, *flag* may be a string of more than
one character. If "info" contains experimental information rather than
flags, the current "info" is not modified. | .. method:: remove_flag(flag)
Unset the flag(s) specified by *flag* without changing other flags. To
remove more than one flag at a time, *flag* may be a string of more than
one character. If "info" contains experimental information rather than
flags, the current "info" is not modified. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6a3dc4e-d79d-431b-9460-33bc74f11846 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,745 | supabase-export-v2 | ce366143bb1183a1 | that record extra information about the message, and a list of all user-defined labels found in the mailbox is kept in the Babyl options section.
:class:`!Babyl` instances have all of the methods of :class:`Mailbox` in
addition to the following: | trusted_official_docs | CPython Docs | that record extra information about the message, and a list of all user-defined labels found in the mailbox is kept in the Babyl options section.
:class:`!Babyl` instances have all of the methods of :class:`Mailbox` in
addition to the following: | that record extra information about the message, and a list of all user-defined labels found in the mailbox is kept in the Babyl options section.
:class:`!Babyl` instances have all of the methods of :class:`Mailbox` in
addition to the following: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f6f15ec5-86d8-43f5-9b51-60a5376db040 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,826 | supabase-export-v2 | 9390fdb8082f5698 | .. method:: get_from()
Return a string representing the "From " line that marks the start of the
message in an mbox mailbox. The leading "From " and the trailing newline
are excluded. | trusted_official_docs | CPython Docs | .. method:: get_from()
Return a string representing the "From " line that marks the start of the
message in an mbox mailbox. The leading "From " and the trailing newline
are excluded. | .. method:: get_from()
Return a string representing the "From " line that marks the start of the
message in an mbox mailbox. The leading "From " and the trailing newline
are excluded. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f82c52d4-e99e-45de-a235-497bc0787cf4 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,813 | supabase-export-v2 | 508b32fe209a1411 | When a :class:`!MaildirMessage` instance is created based upon an :class:`MHMessage` instance, the following conversions take place:
+-------------------------------+--------------------------+
| Resulting state | :class:`MHMessage` state |
+===============================+==========================+
| "cur" subdirecto... | trusted_official_docs | CPython Docs | When a :class:`!MaildirMessage` instance is created based upon an :class:`MHMessage` instance, the following conversions take place:
+-------------------------------+--------------------------+
| Resulting state | :class:`MHMessage` state |
+===============================+==========================+
| "cur" subdirecto... | When a :class:`!MaildirMessage` instance is created based upon an :class:`MHMessage` instance, the following conversions take place:
+-------------------------------+--------------------------+
| Resulting state | :class:`MHMessage` state |
+===============================+==========================+
| "cur" subdirecto... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f85f24fa-c38f-48d7-820f-c9b61dee89e0 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,705 | supabase-export-v2 | 23cc8378fdd75fc1 | which are named lists used to logically group messages without moving them to sub-folders. Sequences are defined in a file called :file:`.mh_sequences` in each folder.
The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to
emulate all of :program:`mh`'s behaviors. In particular, it does not modify... | trusted_official_docs | CPython Docs | which are named lists used to logically group messages without moving them to sub-folders. Sequences are defined in a file called :file:`.mh_sequences` in each folder.
The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to
emulate all of :program:`mh`'s behaviors. In particular, it does not modify... | which are named lists used to logically group messages without moving them to sub-folders. Sequences are defined in a file called :file:`.mh_sequences` in each folder.
The :class:`!MH` class manipulates MH mailboxes, but it does not attempt to
emulate all of :program:`mh`'s behaviors. In particular, it does not modify... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8de0a6e-2b37-4efd-bb0d-7c938ea57031 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,824 | supabase-export-v2 | b93a0948507a50c9 | :mailheader:`Status` header, and the "D", "F", and "A" flags are stored in the :mailheader:`X-Status` header. The flags and headers typically appear in the order mentioned.
:class:`!mboxMessage` instances offer the following methods: | trusted_official_docs | CPython Docs | :mailheader:`Status` header, and the "D", "F", and "A" flags are stored in the :mailheader:`X-Status` header. The flags and headers typically appear in the order mentioned.
:class:`!mboxMessage` instances offer the following methods: | :mailheader:`Status` header, and the "D", "F", and "A" flags are stored in the :mailheader:`X-Status` header. The flags and headers typically appear in the order mentioned.
:class:`!mboxMessage` instances offer the following methods: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fa70d8e8-9aef-47b6-a4df-de58aad6d865 | CPython Docs | file://datasets/cpython/Doc/library/mailbox.rst | unknown | 0846099f-ac60-4881-88e4-45e8ce607a85 | 50,873 | supabase-export-v2 | f436af395988c494 | displays only visible headers. The :class:`!BabylMessage` class, though, uses the original headers because they are more complete. Visible headers may be accessed explicitly if desired.
:class:`!BabylMessage` instances offer the following methods: | trusted_official_docs | CPython Docs | displays only visible headers. The :class:`!BabylMessage` class, though, uses the original headers because they are more complete. Visible headers may be accessed explicitly if desired.
:class:`!BabylMessage` instances offer the following methods: | displays only visible headers. The :class:`!BabylMessage` class, though, uses the original headers because they are more complete. Visible headers may be accessed explicitly if desired.
:class:`!BabylMessage` instances offer the following methods: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
02beb597-0098-480a-a90d-ada961bbd076 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,192 | supabase-export-v2 | 2db5ef0ef0425138 | .. function:: findall(pattern, string, flags=0)
Return all non-overlapping matches of *pattern* in *string*, as a list of
strings or tuples. The *string* is scanned left-to-right, and matches
are returned in the order found. Empty matches are included in the result. | trusted_official_docs | CPython Docs | .. function:: findall(pattern, string, flags=0)
Return all non-overlapping matches of *pattern* in *string*, as a list of
strings or tuples. The *string* is scanned left-to-right, and matches
are returned in the order found. Empty matches are included in the result. | .. function:: findall(pattern, string, flags=0)
Return all non-overlapping matches of *pattern* in *string*, as a list of
strings or tuples. The *string* is scanned left-to-right, and matches
are returned in the order found. Empty matches are included in the result. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
035683d2-7d9f-45ab-9d87-caf864236587 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,378 | supabase-export-v2 | b2bc91416ae0e5aa | Regular expressions beginning with ``'^'`` can be used with :func:`search` to restrict the match at the beginning of the string::
>>> 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'> | trusted_official_docs | CPython Docs | Regular expressions beginning with ``'^'`` can be used with :func:`search` to restrict the match at the beginning of the string::
>>> 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'> | Regular expressions beginning with ``'^'`` can be used with :func:`search` to restrict the match at the beginning of the string::
>>> 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'> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
04e08d14-1ac7-451c-a00d-e5a246870083 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,028 | supabase-export-v2 | 770198f5e0a84243 | .. versionchanged:: 3.7 The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group.
``(?>...)``
Attempts to match ``...`` as if it was a separate regular expression, and
if successful, continues to match the rest of the pattern following it. If the subsequent pattern fails to match, the stack can only be un... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7 The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group.
``(?>...)``
Attempts to match ``...`` as if it was a separate regular expression, and
if successful, continues to match the rest of the pattern following it. If the subsequent pattern fails to match, the stack can only be un... | .. versionchanged:: 3.7 The letters ``'a'``, ``'L'`` and ``'u'`` also can be used in a group.
``(?>...)``
Attempts to match ``...`` as if it was a separate regular expression, and
if successful, continues to match the rest of the pattern following it. If the subsequent pattern fails to match, the stack can only be un... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0559787b-6634-4526-b79a-aa0b97d25cc3 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,162 | supabase-export-v2 | ead7e3abb08b0357 | .. function:: search(pattern, string, flags=0)
Scan through *string* looking for the first location where the regular expression
*pattern* produces a match, and return a corresponding :class:`~re.Match`. Return
``None`` if no position in the string matches the pattern; note that this is
different from finding a zero... | trusted_official_docs | CPython Docs | .. function:: search(pattern, string, flags=0)
Scan through *string* looking for the first location where the regular expression
*pattern* produces a match, and return a corresponding :class:`~re.Match`. Return
``None`` if no position in the string matches the pattern; note that this is
different from finding a zero... | .. function:: search(pattern, string, flags=0)
Scan through *string* looking for the first location where the regular expression
*pattern* produces a match, and return a corresponding :class:`~re.Match`. Return
``None`` if no position in the string matches the pattern; note that this is
different from finding a zero... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05a83322-a0bc-47ae-a063-5c371566948a | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,377 | supabase-export-v2 | 4103b3d5d84bd4cb | 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
Regular expressions beginning with ``'^'`` can be used with :func:`search` to
restrict the match at the begin... | trusted_official_docs | CPython Docs | 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
Regular expressions beginning with ``'^'`` can be used with :func:`search` to
restrict the match at the begin... | 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
Regular expressions beginning with ``'^'`` can be used with :func:`search` to
restrict the match at the begin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
065eab7c-2469-456d-b201-14a505d15bac | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,402 | supabase-export-v2 | 3a93d2ffe0266490 | .. doctest:: :options: +NORMALIZE_WHITESPACE
>>> [re.split(":? ", entry, maxsplit=4) 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', 'Albrech... | trusted_official_docs | CPython Docs | .. doctest:: :options: +NORMALIZE_WHITESPACE
>>> [re.split(":? ", entry, maxsplit=4) 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', 'Albrech... | .. doctest:: :options: +NORMALIZE_WHITESPACE
>>> [re.split(":? ", entry, maxsplit=4) 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', 'Albrech... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
08a6503c-cfc3-4100-bc17-414a8ba00a40 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,400 | supabase-export-v2 | fc97e52bb53a8883 | [['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']]
The ``:?`` pattern matches the colon after the last name, so that it does not
occ... | 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']]
The ``:?`` pattern matches the colon after the last name, so that it does not
occ... | [['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']]
The ``:?`` pattern matches the colon after the last name, so that it does not
occ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
08d1d13c-99e2-4802-ac73-824a9f71f4eb | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,142 | supabase-export-v2 | d4e1a54b556e77f8 | .. data:: U UNICODE
In Python 3, Unicode characters are matched by default
for ``str`` patterns. This flag is therefore redundant with **no effect**
and is only kept for backward compatibility. | trusted_official_docs | CPython Docs | .. data:: U UNICODE
In Python 3, Unicode characters are matched by default
for ``str`` patterns. This flag is therefore redundant with **no effect**
and is only kept for backward compatibility. | .. data:: U UNICODE
In Python 3, Unicode characters are matched by default
for ``str`` patterns. This flag is therefore redundant with **no effect**
and is only kept for backward compatibility. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0923199a-b97b-4175-a153-d65f71fa913e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,040 | supabase-export-v2 | 188d51244eae3385 | .. index:: single: (?=; in regular expressions
``(?=...)``
Matches if ``...`` matches next, but doesn't consume any of the string. This is
called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match
``'Isaac '`` only if it's followed by ``'Asimov'``. | trusted_official_docs | CPython Docs | .. index:: single: (?=; in regular expressions
``(?=...)``
Matches if ``...`` matches next, but doesn't consume any of the string. This is
called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match
``'Isaac '`` only if it's followed by ``'Asimov'``. | .. index:: single: (?=; in regular expressions
``(?=...)``
Matches if ``...`` matches next, but doesn't consume any of the string. This is
called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match
``'Isaac '`` only if it's followed by ``'Asimov'``. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09ba6e04-f01a-4d1b-92f8-dbc64872c82c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,180 | supabase-export-v2 | 35e9fa679dc5502b | If *maxsplit* is nonzero, at most *maxsplit* splits occur, and the remainder of the string is returned as the final element of the list. ::
>>> re.split(r'\W+', 'Words, words, words.')
['Words', 'words', 'words', '']
>>> re.split(r'(\W+)', 'Words, words, words.')
['Words', ', ', 'words', ', ', 'words', '.', '']
>>>... | trusted_official_docs | CPython Docs | If *maxsplit* is nonzero, at most *maxsplit* splits occur, and the remainder of the string is returned as the final element of the list. ::
>>> re.split(r'\W+', 'Words, words, words.')
['Words', 'words', 'words', '']
>>> re.split(r'(\W+)', 'Words, words, words.')
['Words', ', ', 'words', ', ', 'words', '.', '']
>>>... | If *maxsplit* is nonzero, at most *maxsplit* splits occur, and the remainder of the string is returned as the final element of the list. ::
>>> re.split(r'\W+', 'Words, words, words.')
['Words', 'words', 'words', '']
>>> re.split(r'(\W+)', 'Words, words, words.')
['Words', ', ', 'words', ', ', 'words', '.', '']
>>>... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
09d8c3f6-cc4e-46d1-8888-905892d3dfa3 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,004 | supabase-export-v2 | 0bf79171a139efeb | .. index:: single: ^ (caret); in regular expressions
* Characters that are not within a range can be matched by :dfn:`complementing`
the set. If the first character of the set is ``'^'``, all the characters
that are *not* in the set will be matched. For example, ``[^5]`` will match
any character except ``'5'``, and ... | trusted_official_docs | CPython Docs | .. index:: single: ^ (caret); in regular expressions
* Characters that are not within a range can be matched by :dfn:`complementing`
the set. If the first character of the set is ``'^'``, all the characters
that are *not* in the set will be matched. For example, ``[^5]`` will match
any character except ``'5'``, and ... | .. index:: single: ^ (caret); in regular expressions
* Characters that are not within a range can be matched by :dfn:`complementing`
the set. If the first character of the set is ``'^'``, all the characters
that are *not* in the set will be matched. For example, ``[^5]`` will match
any character except ``'5'``, and ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0c4cf6b7-8997-42a5-9b8d-74481f8b7ba3 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,978 | supabase-export-v2 | 16906bb71c20dc68 | 1 or more repetitions of the preceding RE. ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not match just 'a'.
.. index:: single: ? (question mark); in regular expressions | trusted_official_docs | CPython Docs | 1 or more repetitions of the preceding RE. ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not match just 'a'.
.. index:: single: ? (question mark); in regular expressions | 1 or more repetitions of the preceding RE. ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not match just 'a'.
.. index:: single: ? (question mark); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d104d63-5d2f-4387-bd1c-afbbdee304cc | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,977 | supabase-export-v2 | 3911080206ba2529 | .. index:: single: + (plus); in regular expressions
``+``
Causes the resulting RE to match 1 or more repetitions of the preceding RE. ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not
match just 'a'. | trusted_official_docs | CPython Docs | .. index:: single: + (plus); in regular expressions
``+``
Causes the resulting RE to match 1 or more repetitions of the preceding RE. ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not
match just 'a'. | .. index:: single: + (plus); in regular expressions
``+``
Causes the resulting RE to match 1 or more repetitions of the preceding RE. ``ab+`` will match 'a' followed by any non-zero number of 'b's; it will not
match just 'a'. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0d34f62f-a6bd-4cb6-9d34-aa2dbf039931 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,001 | supabase-export-v2 | de6a1595be878844 | Special characters except backslash lose their special meaning inside sets. For example, ``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, ``'*'``, or ``')'``.
.. index:: single: \ (backslash); in regular expressions | trusted_official_docs | CPython Docs | Special characters except backslash lose their special meaning inside sets. For example, ``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, ``'*'``, or ``')'``.
.. index:: single: \ (backslash); in regular expressions | Special characters except backslash lose their special meaning inside sets. For example, ``[(+*)]`` will match any of the literal characters ``'('``, ``'+'``, ``'*'``, or ``')'``.
.. index:: single: \ (backslash); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0dd8f179-b2d6-4547-bdc6-2bbebd26ec95 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,354 | supabase-export-v2 | 06403503651a8e1d | hand, ``"727ak"``, contained a pair, or two of the same valued cards. To match this with a regular expression, one could use backreferences as such::
>>> pair_re = re.compile(r".*(.).*\1")
>>> displaymatch(pair_re.prefixmatch("717ak")) # Pair of 7s. "<Match: '717', groups=('7',)>"
>>> displaymatch(pair_re.prefixmatch... | trusted_official_docs | CPython Docs | hand, ``"727ak"``, contained a pair, or two of the same valued cards. To match this with a regular expression, one could use backreferences as such::
>>> pair_re = re.compile(r".*(.).*\1")
>>> displaymatch(pair_re.prefixmatch("717ak")) # Pair of 7s. "<Match: '717', groups=('7',)>"
>>> displaymatch(pair_re.prefixmatch... | hand, ``"727ak"``, contained a pair, or two of the same valued cards. To match this with a regular expression, one could use backreferences as such::
>>> pair_re = re.compile(r".*(.).*\1")
>>> displaymatch(pair_re.prefixmatch("717ak")) # Pair of 7s. "<Match: '717', groups=('7',)>"
>>> displaymatch(pair_re.prefixmatch... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0e8c0ddf-4a30-451f-9a3a-a976c6aa6ea8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,415 | supabase-export-v2 | d89bd88db0fb925c | >>> re.search(r"\W(.)\1\W", " ff ") <re.Match object; span=(0, 4), match=' ff '> >>> re.search("\\W(.)\\1\\W", " ff ") <re.Match object; span=(0, 4), match=' ff '>
When one wants to match a literal backslash, it must be escaped in the regular
expression. With raw string notation, this means ``r"\\"``. Without raw strin... | trusted_official_docs | CPython Docs | >>> re.search(r"\W(.)\1\W", " ff ") <re.Match object; span=(0, 4), match=' ff '> >>> re.search("\\W(.)\\1\\W", " ff ") <re.Match object; span=(0, 4), match=' ff '>
When one wants to match a literal backslash, it must be escaped in the regular
expression. With raw string notation, this means ``r"\\"``. Without raw strin... | >>> re.search(r"\W(.)\1\W", " ff ") <re.Match object; span=(0, 4), match=' ff '> >>> re.search("\\W(.)\\1\\W", " ff ") <re.Match object; span=(0, 4), match=' ff '>
When one wants to match a literal backslash, it must be escaped in the regular
expression. With raw string notation, this means ``r"\\"``. Without raw strin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1069e85a-5d3b-4757-9417-a8b20dd3633b | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,206 | supabase-export-v2 | 4443ea42ef79e1bd | ... else: return '-' ... >>> re.sub('-{1,2}', dashrepl, 'pro----gram-files') 'pro--gram files' >>> re.sub(r'\sAND\s', ' & ', 'Baked Beans And Spam', flags=re.IGNORECASE) 'Baked Beans & Spam'
The pattern may be a string or a :class:`~re.Pattern`. | trusted_official_docs | CPython Docs | ... else: return '-' ... >>> re.sub('-{1,2}', dashrepl, 'pro----gram-files') 'pro--gram files' >>> re.sub(r'\sAND\s', ' & ', 'Baked Beans And Spam', flags=re.IGNORECASE) 'Baked Beans & Spam'
The pattern may be a string or a :class:`~re.Pattern`. | ... else: return '-' ... >>> re.sub('-{1,2}', dashrepl, 'pro----gram-files') 'pro--gram files' >>> re.sub(r'\sAND\s', ' & ', 'Baked Beans And Spam', flags=re.IGNORECASE) 'Baked Beans & Spam'
The pattern may be a string or a :class:`~re.Pattern`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
131181df-c5f2-4132-8ad9-ac6b0e6aabf4 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,130 | supabase-export-v2 | 2852ed8c024a7b8b | .. versionchanged:: 3.6 :py:const:`~re.LOCALE` can be used only with bytes patterns and is not compatible with :py:const:`~re.ASCII`.
.. versionchanged:: 3.7
Compiled regular expression objects with the :py:const:`~re.LOCALE` flag
no longer depend on the locale at compile time. Only the locale at matching time affect... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.6 :py:const:`~re.LOCALE` can be used only with bytes patterns and is not compatible with :py:const:`~re.ASCII`.
.. versionchanged:: 3.7
Compiled regular expression objects with the :py:const:`~re.LOCALE` flag
no longer depend on the locale at compile time. Only the locale at matching time affect... | .. versionchanged:: 3.6 :py:const:`~re.LOCALE` can be used only with bytes patterns and is not compatible with :py:const:`~re.ASCII`.
.. versionchanged:: 3.7
Compiled regular expression objects with the :py:const:`~re.LOCALE` flag
no longer depend on the locale at compile time. Only the locale at matching time affect... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
140be87d-ef06-4a4b-a06e-a7fb73b613bb | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,153 | supabase-export-v2 | ee4477f9fe5cb946 | a regular expression pattern into a :ref:`regular expression object <re-objects>`, which can be used for matching using its :func:`~Pattern.prefixmatch`, :func:`~Pattern.search`, and other methods, described below.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags... | trusted_official_docs | CPython Docs | a regular expression pattern into a :ref:`regular expression object <re-objects>`, which can be used for matching using its :func:`~Pattern.prefixmatch`, :func:`~Pattern.search`, and other methods, described below.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags... | a regular expression pattern into a :ref:`regular expression object <re-objects>`, which can be used for matching using its :func:`~Pattern.prefixmatch`, :func:`~Pattern.search`, and other methods, described below.
The expression's behaviour can be modified by specifying a *flags* value. Values can be any of the `flags... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1544af18-db56-45a1-88f5-d62a75f8bc02 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,070 | supabase-export-v2 | 8370b9206fc2f3da | (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.
Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used. | trusted_official_docs | CPython Docs | (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.
Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used. | (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.
Matches ``[0-9]`` if the :py:const:`~re.ASCII` flag is used. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1555d0bb-cbe0-4867-a6f8-f6657e549cf6 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,356 | supabase-export-v2 | 3629961fc702d523 | To find out what card the pair consists of, one could use the :meth:`~Match.group` method of the match object in the following manner::
>>> pair_re = re.compile(r".*(.).*\1")
>>> pair_re.prefixmatch("717ak").group(1)
'7' | trusted_official_docs | CPython Docs | To find out what card the pair consists of, one could use the :meth:`~Match.group` method of the match object in the following manner::
>>> pair_re = re.compile(r".*(.).*\1")
>>> pair_re.prefixmatch("717ak").group(1)
'7' | To find out what card the pair consists of, one could use the :meth:`~Match.group` method of the match object in the following manner::
>>> pair_re = re.compile(r".*(.).*\1")
>>> pair_re.prefixmatch("717ak").group(1)
'7' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1691a158-22a4-452b-8a6c-97347235622b | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,227 | supabase-export-v2 | b9bbfc1fda23646d | This function must not be used for the replacement string in :func:`sub` and :func:`subn`, only backslashes should be escaped. For example::
>>> digits_re = r'\d+'
>>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'
>>> print(re.sub(digits_re, digits_re.replace('\\', r'\\'), sample))
/usr/sbin/sendmail - \d+ e... | trusted_official_docs | CPython Docs | This function must not be used for the replacement string in :func:`sub` and :func:`subn`, only backslashes should be escaped. For example::
>>> digits_re = r'\d+'
>>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'
>>> print(re.sub(digits_re, digits_re.replace('\\', r'\\'), sample))
/usr/sbin/sendmail - \d+ e... | This function must not be used for the replacement string in :func:`sub` and :func:`subn`, only backslashes should be escaped. For example::
>>> digits_re = r'\d+'
>>> sample = '/usr/sbin/sendmail - 0 errors, 12 warnings'
>>> print(re.sub(digits_re, digits_re.replace('\\', r'\\'), sample))
/usr/sbin/sendmail - \d+ e... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
16a9ad48-ae6c-435f-a8ce-2b7081cdda71 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,970 | supabase-export-v2 | 974740db7c5fb338 | 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: ^ (caret); in regular expressions | trusted_official_docs | CPython Docs | 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: ^ (caret); in regular expressions | 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: ^ (caret); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1816c901-8577-4417-a373-41b9677f0f59 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,033 | supabase-export-v2 | dd43877f134ebf14 | 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):
+---------------------------------------+----------------------------------+
| Context of reference to group "quote" | Ways to reference it |
+=====... | trusted_official_docs | CPython Docs | 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):
+---------------------------------------+----------------------------------+
| Context of reference to group "quote" | Ways to reference it |
+=====... | 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):
+---------------------------------------+----------------------------------+
| Context of reference to group "quote" | Ways to reference it |
+=====... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1925e6d1-f29b-4925-b386-f62e5d92f9ba | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,954 | supabase-export-v2 | e8b367c16c97fdbf | or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string.
Regular expressions use the backslash character (``'\'``) to indicate
special forms or to allow special characters to be used without invoking
their special meaning. This ... | trusted_official_docs | CPython Docs | or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string.
Regular expressions use the backslash character (``'\'``) to indicate
special forms or to allow special characters to be used without invoking
their special meaning. This ... | or vice-versa; similarly, when asking for a substitution, the replacement string must be of the same type as both the pattern and the search string.
Regular expressions use the backslash character (``'\'``) to indicate
special forms or to allow special characters to be used without invoking
their special meaning. This ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
19479b08-caba-4d4c-b3cc-abeef1012a77 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,217 | supabase-export-v2 | 9ac684e0107c17a5 | .. 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'\x00'``-``b'\x7f'``).
.. deprecated:: 3.13
Passing *count* and *flags* as positional arguments is deprecated. In future Python versions they will be
:re... | trusted_official_docs | CPython Docs | .. 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'\x00'``-``b'\x7f'``).
.. deprecated:: 3.13
Passing *count* and *flags* as positional arguments is deprecated. In future Python versions they will be
:re... | .. 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'\x00'``-``b'\x7f'``).
.. deprecated:: 3.13
Passing *count* and *flags* as positional arguments is deprecated. In future Python versions they will be
:re... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1991e7ce-9372-4c1f-a7a7-564fec6635ce | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,121 | supabase-export-v2 | 76ad25ee4313c1ae | .. data:: I IGNORECASE
Perform case-insensitive matching;
expressions like ``[A-Z]`` will also match lowercase letters. Full Unicode matching (such as ``Ü`` matching ``ü``)
also works unless the :py:const:`~re.ASCII` flag
is used to disable non-ASCII matches. The current locale does not change the effect of this fla... | trusted_official_docs | CPython Docs | .. data:: I IGNORECASE
Perform case-insensitive matching;
expressions like ``[A-Z]`` will also match lowercase letters. Full Unicode matching (such as ``Ü`` matching ``ü``)
also works unless the :py:const:`~re.ASCII` flag
is used to disable non-ASCII matches. The current locale does not change the effect of this fla... | .. data:: I IGNORECASE
Perform case-insensitive matching;
expressions like ``[A-Z]`` will also match lowercase letters. Full Unicode matching (such as ``Ü`` matching ``ü``)
also works unless the :py:const:`~re.ASCII` flag
is used to disable non-ASCII matches. The current locale does not change the effect of this fla... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1aba6efc-7f2e-4373-8321-fe673998241f | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,252 | supabase-export-v2 | 938fa75985144872 | .. method:: Pattern.search(string[, pos[, endpos]])
Scan through *string* looking for the first location where this regular
expression produces a match, and return a corresponding :class:`~re.Match`. Return ``None`` if no position in the string matches the pattern; note that
this is different from finding a zero-leng... | trusted_official_docs | CPython Docs | .. method:: Pattern.search(string[, pos[, endpos]])
Scan through *string* looking for the first location where this regular
expression produces a match, and return a corresponding :class:`~re.Match`. Return ``None`` if no position in the string matches the pattern; note that
this is different from finding a zero-leng... | .. method:: Pattern.search(string[, pos[, endpos]])
Scan through *string* looking for the first location where this regular
expression produces a match, and return a corresponding :class:`~re.Match`. Return ``None`` if no position in the string matches the pattern; note that
this is different from finding a zero-leng... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1b3415e5-523b-4e25-bf3c-9b5bab313de8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,965 | supabase-export-v2 | 15085ba19f3710f8 | ``'last'``. (In the rest of this section, we'll write RE's in ``this special style``, usually without quotes, and strings to be matched ``'in single quotes'``.)
Some characters, like ``'|'`` or ``'('``, are special. Special
characters either stand for classes of ordinary characters, or affect
how the regular expression... | trusted_official_docs | CPython Docs | ``'last'``. (In the rest of this section, we'll write RE's in ``this special style``, usually without quotes, and strings to be matched ``'in single quotes'``.)
Some characters, like ``'|'`` or ``'('``, are special. Special
characters either stand for classes of ordinary characters, or affect
how the regular expression... | ``'last'``. (In the rest of this section, we'll write RE's in ``this special style``, usually without quotes, and strings to be matched ``'in single quotes'``.)
Some characters, like ``'|'`` or ``'('``, are special. Special
characters either stand for classes of ordinary characters, or affect
how the regular expression... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1c626def-465f-45d6-96f0-7200a768dc8d | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,420 | supabase-export-v2 | 8a83f79b82d2cf3a | text categories are specified with regular expressions. The technique is to combine those into a single master regular expression and to loop over successive matches::
from typing import NamedTuple
import re | trusted_official_docs | CPython Docs | text categories are specified with regular expressions. The technique is to combine those into a single master regular expression and to loop over successive matches::
from typing import NamedTuple
import re | text categories are specified with regular expressions. The technique is to combine those into a single master regular expression and to loop over successive matches::
from typing import NamedTuple
import re | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1e485669-945f-4c13-b28a-bf4810383c2c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,394 | supabase-export-v2 | 733b84a834fdceaa | ... ... 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"""
The entries are separated by one or more newlines. Now we convert the string
into a list with each nonempty line having its own entry: | trusted_official_docs | CPython Docs | ... ... 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"""
The entries are separated by one or more newlines. Now we convert the string
into a list with each nonempty line having its own entry: | ... ... 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"""
The entries are separated by one or more newlines. Now we convert the string
into a list with each nonempty line having its own entry: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
1f68fb06-f808-4e70-8f4a-9a1fcc80b1ae | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,210 | supabase-export-v2 | 3f2177ea4c542619 | .. index:: single: \g; in regular expressions
In string-type *repl* arguments, in addition to the character escapes and
backreferences described above,
``\g<name>`` will use the substring matched by the group named ``name``, as
defined by the ``(?P<name>...)`` syntax. ``\g<number>`` uses the corresponding
group num... | trusted_official_docs | CPython Docs | .. index:: single: \g; in regular expressions
In string-type *repl* arguments, in addition to the character escapes and
backreferences described above,
``\g<name>`` will use the substring matched by the group named ``name``, as
defined by the ``(?P<name>...)`` syntax. ``\g<number>`` uses the corresponding
group num... | .. index:: single: \g; in regular expressions
In string-type *repl* arguments, in addition to the character escapes and
backreferences described above,
``\g<name>`` will use the substring matched by the group named ``name``, as
defined by the ``(?P<name>...)`` syntax. ``\g<number>`` uses the corresponding
group num... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
238e388f-d976-4d81-a07a-3e6eceed6b00 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,087 | supabase-export-v2 | 4abfd4e0a17a6201 | 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 and the underscore.
.. index:: single: \W; in regular expressions | trusted_official_docs | CPython Docs | 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 and the underscore.
.. index:: single: \W; in regular expressions | 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 and the underscore.
.. index:: single: \W; in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
23ffb212-05fe-4b86-9426-d83b9b906ea5 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,003 | supabase-export-v2 | d7e41f550fef2349 | ``\1`` are always octal escapes, not group references. Special sequences which do not match a single character such as ``\A`` and ``\z`` are not allowed.
.. index:: single: ^ (caret); in regular expressions | trusted_official_docs | CPython Docs | ``\1`` are always octal escapes, not group references. Special sequences which do not match a single character such as ``\A`` and ``\z`` are not allowed.
.. index:: single: ^ (caret); in regular expressions | ``\1`` are always octal escapes, not group references. Special sequences which do not match a single character such as ``\A`` and ``\z`` are not allowed.
.. index:: single: ^ (caret); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
260a41f2-8edc-4a25-be9f-19cb52b6edd0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,012 | supabase-export-v2 | 2874f6d71f43070c | other words, the ``'|'`` operator is never greedy. To match a literal ``'|'``, use ``\|``, or enclose it inside a character class, as in ``[|]``.
.. index::
single: () (parentheses); in regular expressions | trusted_official_docs | CPython Docs | other words, the ``'|'`` operator is never greedy. To match a literal ``'|'``, use ``\|``, or enclose it inside a character class, as in ``[|]``.
.. index::
single: () (parentheses); in regular expressions | other words, the ``'|'`` operator is never greedy. To match a literal ``'|'``, use ``\|``, or enclose it inside a character class, as in ``[|]``.
.. index::
single: () (parentheses); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
27e7c8cc-a2f4-40eb-9b15-a5cdbe29094b | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,169 | supabase-export-v2 | 2d67848b8c0aa05e | If you want to locate a match anywhere in *string*, use :func:`search` instead (see also :ref:`search-vs-match`).
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 you want to locate a match anywhere in *string*, use :func:`search` instead (see also :ref:`search-vs-match`).
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 you want to locate a match anywhere in *string*, use :func:`search` instead (see also :ref:`search-vs-match`).
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 | |
282b1d51-8310-4911-aef6-d80cb2756dc8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,411 | supabase-export-v2 | 10974b8b6c85ccd6 | example, if a writer wanted to find all of the adverbs *and their positions* in some text, they would use :func:`finditer` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
>>> for m in re.finditer(r"\w+ly\b", text):
... print('%02d-%02d: %s' % (m.start(), m.end(), m.gr... | trusted_official_docs | CPython Docs | example, if a writer wanted to find all of the adverbs *and their positions* in some text, they would use :func:`finditer` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
>>> for m in re.finditer(r"\w+ly\b", text):
... print('%02d-%02d: %s' % (m.start(), m.end(), m.gr... | example, if a writer wanted to find all of the adverbs *and their positions* in some text, they would use :func:`finditer` in the following manner::
>>> text = "He was carefully disguised but captured quickly by police."
>>> for m in re.finditer(r"\w+ly\b", text):
... print('%02d-%02d: %s' % (m.start(), m.end(), m.gr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
293b4319-9a09-4426-99ad-2d286922ce8f | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,041 | supabase-export-v2 | e3084d324417365a | consume any of the string. This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``.
.. index:: single: (?!; in regular expressions | trusted_official_docs | CPython Docs | consume any of the string. This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``.
.. index:: single: (?!; in regular expressions | consume any of the string. This is called a :dfn:`lookahead assertion`. For example, ``Isaac (?=Asimov)`` will match ``'Isaac '`` only if it's followed by ``'Asimov'``.
.. index:: single: (?!; in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2b306319-1a7c-4dbd-8398-3d4303ddab3f | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,276 | supabase-export-v2 | 6d880f0b31ada87a | .. method:: Pattern.finditer(string[, pos[, endpos]])
Similar to the :func:`finditer` 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.finditer(string[, pos[, endpos]])
Similar to the :func:`finditer` function, using the compiled pattern, but
also accepts optional *pos* and *endpos* parameters that limit the search
region like for :meth:`search`. | .. method:: Pattern.finditer(string[, pos[, endpos]])
Similar to the :func:`finditer` 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 | |
2ca66326-8525-4234-a1cb-96224a8a4023 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,181 | supabase-export-v2 | b47ba720d302d0fc | ['Words', ', ', 'words', ', ', 'words', '.', ''] >>> re.split(r'\W+', 'Words, words, words.', maxsplit=1) ['Words', 'words, words.'] >>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE) ['0', '3', '9']
If there are capturing groups in the separator and it matches at the start of
the string, the result will start with ... | trusted_official_docs | CPython Docs | ['Words', ', ', 'words', ', ', 'words', '.', ''] >>> re.split(r'\W+', 'Words, words, words.', maxsplit=1) ['Words', 'words, words.'] >>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE) ['0', '3', '9']
If there are capturing groups in the separator and it matches at the start of
the string, the result will start with ... | ['Words', ', ', 'words', ', ', 'words', '.', ''] >>> re.split(r'\W+', 'Words, words, words.', maxsplit=1) ['Words', 'words, words.'] >>> re.split('[a-f]+', '0a3B9', flags=re.IGNORECASE) ['0', '3', '9']
If there are capturing groups in the separator and it matches at the start of
the string, the result will start with ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2caeb923-2880-470f-aee0-b1d6fb24ae10 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,257 | supabase-export-v2 | 44a69f96285e1cfa | .. method:: Pattern.prefixmatch(string[, pos[, endpos]])
If zero or more characters at the *beginning* of *string* match this 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. | trusted_official_docs | CPython Docs | .. method:: Pattern.prefixmatch(string[, pos[, endpos]])
If zero or more characters at the *beginning* of *string* match this 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. | .. method:: Pattern.prefixmatch(string[, pos[, endpos]])
If zero or more characters at the *beginning* of *string* match this 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2cb38e03-66de-4d91-82e8-728c09575cba | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,426 | supabase-export-v2 | 0c0a288b2c95f2ca | The tokenizer produces the following output::
Token(type='IF', value='IF', line=2, column=4)
Token(type='ID', value='quantity', line=2, column=7)
Token(type='THEN', value='THEN', line=2, column=16)
Token(type='ID', value='total', line=3, column=8)
Token(type='ASSIGN', value=':=', line=3, column=14)
Token(type='ID'... | trusted_official_docs | CPython Docs | The tokenizer produces the following output::
Token(type='IF', value='IF', line=2, column=4)
Token(type='ID', value='quantity', line=2, column=7)
Token(type='THEN', value='THEN', line=2, column=16)
Token(type='ID', value='total', line=3, column=8)
Token(type='ASSIGN', value=':=', line=3, column=14)
Token(type='ID'... | The tokenizer produces the following output::
Token(type='IF', value='IF', line=2, column=4)
Token(type='ID', value='quantity', line=2, column=7)
Token(type='THEN', value='THEN', line=2, column=16)
Token(type='ID', value='total', line=3, column=8)
Token(type='ASSIGN', value=':=', line=3, column=14)
Token(type='ID'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
2daa9e7d-29dd-439a-80a7-06c072d8dd59 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,963 | supabase-export-v2 | e4a7b2e672e748c9 | ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book [Frie09]_, or almost any textbook about compiler construction.
A brief explanation of the format of regular expressions follows. For further
information and a gentler presentation, consult the :ref:`regex-h... | trusted_official_docs | CPython Docs | ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book [Frie09]_, or almost any textbook about compiler construction.
A brief explanation of the format of regular expressions follows. For further
information and a gentler presentation, consult the :ref:`regex-h... | ones described here. For details of the theory and implementation of regular expressions, consult the Friedl book [Frie09]_, or almost any textbook about compiler construction.
A brief explanation of the format of regular expressions follows. For further
information and a gentler presentation, consult the :ref:`regex-h... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
30e1bece-b027-45f5-983b-f6124e058a15 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,987 | supabase-export-v2 | 875c0c5ff02ddc94 | .. index:: single: {} (curly brackets); in regular expressions
``{m}``
Specifies that exactly *m* copies of the previous 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. | trusted_official_docs | CPython Docs | .. index:: single: {} (curly brackets); in regular expressions
``{m}``
Specifies that exactly *m* copies of the previous 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. | .. index:: single: {} (curly brackets); in regular expressions
``{m}``
Specifies that exactly *m* copies of the previous 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
31af22a6-c90d-4ecd-b336-0ac8c92d948f | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,391 | supabase-export-v2 | 53b1025025d9f6f5 | converting textual data into data structures that can be easily read and modified by Python as demonstrated in the following example that creates a phonebook.
First, here is the input. Normally it may come from a file, here we are using
triple-quoted string syntax | trusted_official_docs | CPython Docs | converting textual data into data structures that can be easily read and modified by Python as demonstrated in the following example that creates a phonebook.
First, here is the input. Normally it may come from a file, here we are using
triple-quoted string syntax | converting textual data into data structures that can be easily read and modified by Python as demonstrated in the following example that creates a phonebook.
First, here is the input. Normally it may come from a file, here we are using
triple-quoted string syntax | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
31c10092-1300-4d04-a7ce-197bf48b9a5d | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,384 | supabase-export-v2 | 003f00dbebe143ea | Why is the :func:`~re.match` function and method discouraged in favor of the longer :func:`~re.prefixmatch` spelling?
Many other languages have gained regex support libraries since regular
expressions were added to Python. However in the most popular of those, they
use the term *match* in their APIs to mean the unancho... | trusted_official_docs | CPython Docs | Why is the :func:`~re.match` function and method discouraged in favor of the longer :func:`~re.prefixmatch` spelling?
Many other languages have gained regex support libraries since regular
expressions were added to Python. However in the most popular of those, they
use the term *match* in their APIs to mean the unancho... | Why is the :func:`~re.match` function and method discouraged in favor of the longer :func:`~re.prefixmatch` spelling?
Many other languages have gained regex support libraries since regular
expressions were added to Python. However in the most popular of those, they
use the term *match* in their APIs to mean the unancho... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
322d9704-9c71-4341-b128-6640fe54bc81 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,953 | supabase-export-v2 | 421d077276d804c5 | This module provides regular expression matching operations similar to those found in Perl.
Both patterns and strings to be searched can be Unicode strings (:class:`str`)
as well as 8-bit strings (:class:`bytes`). However, Unicode strings and 8-bit strings cannot be mixed:
that is, you cannot match a Unicode string wit... | trusted_official_docs | CPython Docs | This module provides regular expression matching operations similar to those found in Perl.
Both patterns and strings to be searched can be Unicode strings (:class:`str`)
as well as 8-bit strings (:class:`bytes`). However, Unicode strings and 8-bit strings cannot be mixed:
that is, you cannot match a Unicode string wit... | This module provides regular expression matching operations similar to those found in Perl.
Both patterns and strings to be searched can be Unicode strings (:class:`str`)
as well as 8-bit strings (:class:`bytes`). However, Unicode strings and 8-bit strings cannot be mixed:
that is, you cannot match a Unicode string wit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
335f0970-b3c3-4b2d-9b00-e9cf24758390 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,202 | supabase-export-v2 | ff82440acb525400 | .. function:: sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences
of *pattern* in *string* by the replacement *repl*. If the pattern isn't found,
*string* is returned unchanged. *repl* can be a string or a function; if it is
a string, any back... | trusted_official_docs | CPython Docs | .. function:: sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences
of *pattern* in *string* by the replacement *repl*. If the pattern isn't found,
*string* is returned unchanged. *repl* can be a string or a function; if it is
a string, any back... | .. function:: sub(pattern, repl, string, count=0, flags=0)
Return the string obtained by replacing the leftmost non-overlapping occurrences
of *pattern* in *string* by the replacement *repl*. If the pattern isn't found,
*string* is returned unchanged. *repl* can be a string or a function; if it is
a string, any back... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3371547e-80cd-4f29-9614-c59ddda45aea | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,964 | supabase-export-v2 | d9f7031815536ea3 | A brief explanation of the format of regular expressions follows. For further information and a gentler presentation, consult the :ref:`regex-howto`.
Regular expressions can contain both special and ordinary characters. Most
ordinary characters, like ``'A'``, ``'a'``, or ``'0'``, are the simplest regular
expressions; t... | trusted_official_docs | CPython Docs | A brief explanation of the format of regular expressions follows. For further information and a gentler presentation, consult the :ref:`regex-howto`.
Regular expressions can contain both special and ordinary characters. Most
ordinary characters, like ``'A'``, ``'a'``, or ``'0'``, are the simplest regular
expressions; t... | A brief explanation of the format of regular expressions follows. For further information and a gentler presentation, consult the :ref:`regex-howto`.
Regular expressions can contain both special and ordinary characters. Most
ordinary characters, like ``'A'``, ``'a'``, or ``'0'``, are the simplest regular
expressions; t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
33c36bb8-7469-4876-9c53-b25b11b21100 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,311 | supabase-export-v2 | e74f58d3c69ba717 | This is identical to ``m.group(g)``. This allows easier access to an individual group from a match::
>>> m = re.search(r"(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m[0] # The entire match
'Norwegian Blue'
>>> m[1] # The first parenthesized subgroup. 'Norwegian'
>>> m[2] # The second parenthesized su... | trusted_official_docs | CPython Docs | This is identical to ``m.group(g)``. This allows easier access to an individual group from a match::
>>> m = re.search(r"(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m[0] # The entire match
'Norwegian Blue'
>>> m[1] # The first parenthesized subgroup. 'Norwegian'
>>> m[2] # The second parenthesized su... | This is identical to ``m.group(g)``. This allows easier access to an individual group from a match::
>>> m = re.search(r"(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m[0] # The entire match
'Norwegian Blue'
>>> m[1] # The first parenthesized subgroup. 'Norwegian'
>>> m[2] # The second parenthesized su... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
34892c5a-a8d2-4a47-a3f1-0d0308334a43 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,374 | supabase-export-v2 | a54bef947d50daa7 | Python offers different primitive operations based on regular expressions:
+ :func:`re.prefixmatch` checks for a match only at the beginning of the string
+ :func:`re.search` checks for a match anywhere in the string
(this is what Perl does by default)
+ :func:`re.fullmatch` checks for entire string to be a match | trusted_official_docs | CPython Docs | Python offers different primitive operations based on regular expressions:
+ :func:`re.prefixmatch` checks for a match only at the beginning of the string
+ :func:`re.search` checks for a match anywhere in the string
(this is what Perl does by default)
+ :func:`re.fullmatch` checks for entire string to be a match | Python offers different primitive operations based on regular expressions:
+ :func:`re.prefixmatch` checks for a match only at the beginning of the string
+ :func:`re.search` checks for a match anywhere in the string
(this is what Perl does by default)
+ :func:`re.fullmatch` checks for entire string to be a match | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
37fcdbeb-8829-46a0-a247-9ea72c8d0483 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,050 | supabase-export-v2 | a9149e53e5a5b012 | .. index:: single: (?<!; in regular expressions
``(?<!...)``
Matches if the current position in the string is not preceded by a match for
``...``. This is called a :dfn:`negative lookbehind assertion`. Similar to
positive lookbehind assertions, the contained pattern must only match strings of
some fixed length. Pat... | trusted_official_docs | CPython Docs | .. index:: single: (?<!; in regular expressions
``(?<!...)``
Matches if the current position in the string is not preceded by a match for
``...``. This is called a :dfn:`negative lookbehind assertion`. Similar to
positive lookbehind assertions, the contained pattern must only match strings of
some fixed length. Pat... | .. index:: single: (?<!; in regular expressions
``(?<!...)``
Matches if the current position in the string is not preceded by a match for
``...``. This is called a :dfn:`negative lookbehind assertion`. Similar to
positive lookbehind assertions, the contained pattern must only match strings of
some fixed length. Pat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3821dd4a-3450-450f-aa4f-e80eb08f3487 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,190 | supabase-export-v2 | 922f8501a220409e | .. versionchanged:: 3.7 Added support of splitting on a pattern that could match an empty string.
.. deprecated:: 3.13
Passing *maxsplit* and *flags* as positional arguments is deprecated. In future Python versions they will be
:ref:`keyword-only parameters <keyword-only_parameter>`. | trusted_official_docs | CPython Docs | .. versionchanged:: 3.7 Added support of splitting on a pattern that could match an empty string.
.. deprecated:: 3.13
Passing *maxsplit* and *flags* as positional arguments is deprecated. In future Python versions they will be
:ref:`keyword-only parameters <keyword-only_parameter>`. | .. versionchanged:: 3.7 Added support of splitting on a pattern that could match an empty string.
.. deprecated:: 3.13
Passing *maxsplit* and *flags* as positional arguments is deprecated. In future Python versions they will be
:ref:`keyword-only parameters <keyword-only_parameter>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
382ae295-2d57-4f90-8e21-ba66b59a0d73 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,174 | supabase-export-v2 | 023d0f60f51f0a35 | languages and regular expression implementations is to use the term *match* to refer to the behavior of what Python has always called :func:`~re.search`. See :ref:`prefixmatch-vs-match`.
.. function:: fullmatch(pattern, string, flags=0) | 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 :func:`~re.search`. See :ref:`prefixmatch-vs-match`.
.. function:: fullmatch(pattern, string, flags=0) | languages and regular expression implementations is to use the term *match* to refer to the behavior of what Python has always called :func:`~re.search`. See :ref:`prefixmatch-vs-match`.
.. function:: fullmatch(pattern, string, flags=0) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c811f17-789d-4230-8b44-8083a66d5082 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,300 | supabase-export-v2 | eca0d4f54b7949f7 | .. method:: Match.group([group1, ...])
Returns one or more subgroups of the match. If there is a single argument, the
result is a single string; if there are multiple arguments, the result is a
tuple with one item per argument. Without arguments, *group1* defaults to zero
(the whole match is returned). If a *groupN*... | trusted_official_docs | CPython Docs | .. method:: Match.group([group1, ...])
Returns one or more subgroups of the match. If there is a single argument, the
result is a single string; if there are multiple arguments, the result is a
tuple with one item per argument. Without arguments, *group1* defaults to zero
(the whole match is returned). If a *groupN*... | .. method:: Match.group([group1, ...])
Returns one or more subgroups of the match. If there is a single argument, the
result is a single string; if there are multiple arguments, the result is a
tuple with one item per argument. Without arguments, *group1* defaults to zero
(the whole match is returned). If a *groupN*... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e2dcdba-8aba-4e70-946f-2a87bd6c5088 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,974 | supabase-export-v2 | 3925357b3773adc8 | searching for a single ``$`` in ``'foo\n'`` will find two (empty) matches: one just before the newline, and one at the end of the string.
.. index:: single: * (asterisk); in regular expressions | trusted_official_docs | CPython Docs | searching for a single ``$`` in ``'foo\n'`` will find two (empty) matches: one just before the newline, and one at the end of the string.
.. index:: single: * (asterisk); in regular expressions | searching for a single ``$`` in ``'foo\n'`` will find two (empty) matches: one just before the newline, and one at the end of the string.
.. index:: single: * (asterisk); in regular expressions | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e48e4c0-64c0-4a04-b2a1-5053d9eb4219 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,362 | supabase-export-v2 | 22e8a312b5672405 | more powerful, though also more verbose, than :c:func:`!scanf` format strings. The table below offers some more-or-less equivalent mappings between :c:func:`!scanf` format tokens and regular expressions.
+--------------------------------+---------------------------------------------+
| :c:func:`!scanf` Token | Regular ... | trusted_official_docs | CPython Docs | more powerful, though also more verbose, than :c:func:`!scanf` format strings. The table below offers some more-or-less equivalent mappings between :c:func:`!scanf` format tokens and regular expressions.
+--------------------------------+---------------------------------------------+
| :c:func:`!scanf` Token | Regular ... | more powerful, though also more verbose, than :c:func:`!scanf` format strings. The table below offers some more-or-less equivalent mappings between :c:func:`!scanf` format tokens and regular expressions.
+--------------------------------+---------------------------------------------+
| :c:func:`!scanf` Token | Regular ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f9403e2-2336-4765-9535-58c2c8dbfb29 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,333 | supabase-export-v2 | 739bbc08f7ad00b3 | .. attribute:: Match.pos
The value of *pos* 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 at which the RE engine started looking for a match. | trusted_official_docs | CPython Docs | .. attribute:: Match.pos
The value of *pos* 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 at which the RE engine started looking for a match. | .. attribute:: Match.pos
The value of *pos* 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 at which the RE engine started looking for a match. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4057357c-a054-4f01-a187-afe0857bec21 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,282 | supabase-export-v2 | 3181a43336214074 | .. attribute:: Pattern.flags
The regex matching flags. This is a combination of the flags given to
:func:`.compile`, any ``(?...)`` inline flags in the pattern, and implicit
flags such as :py:const:`~re.UNICODE` if the pattern is a Unicode string. | trusted_official_docs | CPython Docs | .. attribute:: Pattern.flags
The regex matching flags. This is a combination of the flags given to
:func:`.compile`, any ``(?...)`` inline flags in the pattern, and implicit
flags such as :py:const:`~re.UNICODE` if the pattern is a Unicode string. | .. attribute:: Pattern.flags
The regex matching flags. This is a combination of the flags given to
:func:`.compile`, any ``(?...)`` inline flags in the pattern, and implicit
flags such as :py:const:`~re.UNICODE` if the pattern is a Unicode string. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4132bd71-dbed-493c-97c9-b3e82a2304f0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,008 | supabase-export-v2 | ff9e3eb5ad383df1 | sets starting with a literal ``'['`` or containing literal character sequences ``'--'``, ``'&&'``, ``'~~'``, and ``'||'``. To avoid a warning escape them with a backslash.
.. _Unicode Technical Standard #18: https://unicode.org/reports/tr18/ | trusted_official_docs | CPython Docs | sets starting with a literal ``'['`` or containing literal character sequences ``'--'``, ``'&&'``, ``'~~'``, and ``'||'``. To avoid a warning escape them with a backslash.
.. _Unicode Technical Standard #18: https://unicode.org/reports/tr18/ | sets starting with a literal ``'['`` or containing literal character sequences ``'--'``, ``'&&'``, ``'~~'``, and ``'||'``. To avoid a warning escape them with a backslash.
.. _Unicode Technical Standard #18: https://unicode.org/reports/tr18/ | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4199d5ce-7bed-45a1-9970-f7fb9e25e659 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,999 | supabase-export-v2 | f2ff60441854e90c | .. index:: single: - (minus); in regular expressions
* Ranges of characters can be indicated by giving two characters and separating
them by a ``'-'``, for example ``[a-z]`` will match any lowercase ASCII letter,
``[0-5][0-9]`` will match all the two-digits numbers from ``00`` to ``59``, and
``[0-9A-Fa-f]`` will mat... | trusted_official_docs | CPython Docs | .. index:: single: - (minus); in regular expressions
* Ranges of characters can be indicated by giving two characters and separating
them by a ``'-'``, for example ``[a-z]`` will match any lowercase ASCII letter,
``[0-5][0-9]`` will match all the two-digits numbers from ``00`` to ``59``, and
``[0-9A-Fa-f]`` will mat... | .. index:: single: - (minus); in regular expressions
* Ranges of characters can be indicated by giving two characters and separating
them by a ``'-'``, for example ``[a-z]`` will match any lowercase ASCII letter,
``[0-5][0-9]`` will match all the two-digits numbers from ``00`` to ``59``, and
``[0-9A-Fa-f]`` will mat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
41bdd16d-9a64-4c8a-94a3-1d424d323c23 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,427 | supabase-export-v2 | cb942ed507565a07 | column=12) Token(type='ID', value='price', line=4, column=15) Token(type='OP', value='*', line=4, column=21) Token(type='NUMBER', value=0.05, line=4, column=23) Token(type='END', value=';', line=4, column=27) Token(type='ENDIF', value='ENDIF', line=5, column=4) Token(type='END', value=';', line=5, column=9)
.. [Frie09]... | trusted_official_docs | CPython Docs | column=12) Token(type='ID', value='price', line=4, column=15) Token(type='OP', value='*', line=4, column=21) Token(type='NUMBER', value=0.05, line=4, column=23) Token(type='END', value=';', line=4, column=27) Token(type='ENDIF', value='ENDIF', line=5, column=4) Token(type='END', value=';', line=5, column=9)
.. [Frie09]... | column=12) Token(type='ID', value='price', line=4, column=15) Token(type='OP', value='*', line=4, column=21) Token(type='NUMBER', value=0.05, line=4, column=23) Token(type='END', value=';', line=4, column=27) Token(type='ENDIF', value='ENDIF', line=5, column=4) Token(type='END', value=';', line=5, column=9)
.. [Frie09]... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
42239850-c8d8-48bb-b3fb-70c4e4731560 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,089 | supabase-export-v2 | 41b558d861526d59 | any character which is not a word character. This is the opposite of ``\w``. By default, matches non-underscore (``_``) characters for which :py:meth:`str.isalnum` returns ``False``.
Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used. | trusted_official_docs | CPython Docs | any character which is not a word character. This is the opposite of ``\w``. By default, matches non-underscore (``_``) characters for which :py:meth:`str.isalnum` returns ``False``.
Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used. | any character which is not a word character. This is the opposite of ``\w``. By default, matches non-underscore (``_``) characters for which :py:meth:`str.isalnum` returns ``False``.
Matches ``[^a-zA-Z0-9_]`` if the :py:const:`~re.ASCII` flag is used. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
44aef6be-4e94-4354-aaec-436a7c5fb4c6 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,414 | supabase-export-v2 | f22c31e70e93fe10 | 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::
>>> re.search(r"\W(.)\1\W", " ff ")
<re.Match object; span=(0, 4), match=' ff '>
>>> re.search("\\W(.)\\1\\W", " ff ")
<re.Match object; span=(0, 4), match=' ff '> | trusted_official_docs | CPython Docs | 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::
>>> re.search(r"\W(.)\1\W", " ff ")
<re.Match object; span=(0, 4), match=' ff '>
>>> re.search("\\W(.)\\1\\W", " ff ")
<re.Match object; span=(0, 4), match=' ff '> | 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::
>>> re.search(r"\W(.)\1\W", " ff ")
<re.Match object; span=(0, 4), match=' ff '>
>>> re.search("\\W(.)\\1\\W", " ff ")
<re.Match object; span=(0, 4), match=' ff '> | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
44e7c843-6a89-4b56-8ca6-49752baa64c9 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,198 | supabase-export-v2 | 0b1f4650b2c3d039 | .. function:: finditer(pattern, string, flags=0)
Return an :term:`iterator` yielding :class:`~re.Match` objects over
all non-overlapping matches for 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. | trusted_official_docs | CPython Docs | .. function:: finditer(pattern, string, flags=0)
Return an :term:`iterator` yielding :class:`~re.Match` objects over
all non-overlapping matches for 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. | .. function:: finditer(pattern, string, flags=0)
Return an :term:`iterator` yielding :class:`~re.Match` objects over
all non-overlapping matches for 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. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
461e79d0-0bc6-4a95-b9b9-d1895c1df7c0 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,066 | supabase-export-v2 | cb1b59df58157d27 | .. index:: single: \B; in regular expressions
``\B``
Matches the empty string,
but only when it is *not* at the beginning or end of a word. This means that ``r'at\B'`` matches ``'athens'``, ``'atom'``,
``'attorney'``, but not ``'at'``, ``'at.'``, or ``'at!'``. ``\B`` is the opposite of ``\b``,
so word characters in... | trusted_official_docs | CPython Docs | .. index:: single: \B; in regular expressions
``\B``
Matches the empty string,
but only when it is *not* at the beginning or end of a word. This means that ``r'at\B'`` matches ``'athens'``, ``'atom'``,
``'attorney'``, but not ``'at'``, ``'at.'``, or ``'at!'``. ``\B`` is the opposite of ``\b``,
so word characters in... | .. index:: single: \B; in regular expressions
``\B``
Matches the empty string,
but only when it is *not* at the beginning or end of a word. This means that ``r'at\B'`` matches ``'athens'``, ``'atom'``,
``'attorney'``, but not ``'at'``, ``'at.'``, or ``'at!'``. ``\B`` is the opposite of ``\b``,
so word characters in... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
467df0cd-6df0-401e-8637-ce4f8478287d | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,352 | supabase-export-v2 | 906b93ebafb6bc99 | To see if a given string is a valid hand, one could do the following::
>>> valid_hand_re = re.compile(r"^[a2-9tjqk]{5}$")
>>> displaymatch(valid_hand_re.search("akt5q")) # Valid. "<Match: 'akt5q', groups=()>"
>>> displaymatch(valid_hand_re.search("akt5e")) # Invalid. >>> displaymatch(valid_hand_re.search("akt")) # In... | trusted_official_docs | CPython Docs | To see if a given string is a valid hand, one could do the following::
>>> valid_hand_re = re.compile(r"^[a2-9tjqk]{5}$")
>>> displaymatch(valid_hand_re.search("akt5q")) # Valid. "<Match: 'akt5q', groups=()>"
>>> displaymatch(valid_hand_re.search("akt5e")) # Invalid. >>> displaymatch(valid_hand_re.search("akt")) # In... | To see if a given string is a valid hand, one could do the following::
>>> valid_hand_re = re.compile(r"^[a2-9tjqk]{5}$")
>>> displaymatch(valid_hand_re.search("akt5q")) # Valid. "<Match: 'akt5q', groups=()>"
>>> displaymatch(valid_hand_re.search("akt5e")) # Invalid. >>> displaymatch(valid_hand_re.search("akt")) # In... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46a0fea5-6cc7-4de4-ae57-30e08d450af6 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,207 | supabase-export-v2 | e8cfda33c887b916 | The pattern may be a string or a :class:`~re.Pattern`.
The optional argument *count* is the maximum number of pattern occurrences to be
replaced; *count* must be a non-negative integer. If omitted or zero, all
occurrences will be replaced. | trusted_official_docs | CPython Docs | The pattern may be a string or a :class:`~re.Pattern`.
The optional argument *count* is the maximum number of pattern occurrences to be
replaced; *count* must be a non-negative integer. If omitted or zero, all
occurrences will be replaced. | The pattern may be a string or a :class:`~re.Pattern`.
The optional argument *count* is the maximum number of pattern occurrences to be
replaced; *count* must be a non-negative integer. If omitted or zero, all
occurrences will be replaced. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
473028bd-daf8-41e6-9072-91e380e00bfe | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,361 | supabase-export-v2 | 85f7eb3f10fcfcad | .. index:: single: scanf (C function)
Python does not currently have an equivalent to :c:func:`!scanf`. Regular
expressions are generally more powerful, though also more verbose, than
:c:func:`!scanf` format strings. The table below offers some more-or-less
equivalent mappings between :c:func:`!scanf` format tokens and... | trusted_official_docs | CPython Docs | .. index:: single: scanf (C function)
Python does not currently have an equivalent to :c:func:`!scanf`. Regular
expressions are generally more powerful, though also more verbose, than
:c:func:`!scanf` format strings. The table below offers some more-or-less
equivalent mappings between :c:func:`!scanf` format tokens and... | .. index:: single: scanf (C function)
Python does not currently have an equivalent to :c:func:`!scanf`. Regular
expressions are generally more powerful, though also more verbose, than
:c:func:`!scanf` format strings. The table below offers some more-or-less
equivalent mappings between :c:func:`!scanf` format tokens and... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4994ebbc-8f7a-44eb-9705-701b9fe95d72 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,393 | supabase-export-v2 | c23495c24a584ebb | .. doctest::
>>> text = """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""" | trusted_official_docs | CPython Docs | .. doctest::
>>> text = """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""" | .. doctest::
>>> text = """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""" | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4b60b5a6-785d-4b2f-9b21-6c22e8a3be5e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 50,983 | supabase-export-v2 | c456028e7817339a | .. index:: single: *+; in regular expressions single: ++; in regular expressions single: ?+; in regular expressions
``*+``, ``++``, ``?+``
Like the ``'*'``, ``'+'``, and ``'?'`` quantifiers, those where ``'+'`` is
appended also match as many times as possible. However, unlike the true greedy quantifiers, these do not... | trusted_official_docs | CPython Docs | .. index:: single: *+; in regular expressions single: ++; in regular expressions single: ?+; in regular expressions
``*+``, ``++``, ``?+``
Like the ``'*'``, ``'+'``, and ``'?'`` quantifiers, those where ``'+'`` is
appended also match as many times as possible. However, unlike the true greedy quantifiers, these do not... | .. index:: single: *+; in regular expressions single: ++; in regular expressions single: ?+; in regular expressions
``*+``, ``++``, ``?+``
Like the ``'*'``, ``'+'``, and ``'?'`` quantifiers, those where ``'+'`` is
appended also match as many times as possible. However, unlike the true greedy quantifiers, these do not... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c587b68-3bd1-4deb-ae5e-745f8d5a9c8e | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,328 | supabase-export-v2 | 5afdb1baeb3b3f1e | For example, after ``m = re.search('b(c?)', 'cba')``, ``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both 2, and ``m.start(2)`` raises an :exc:`IndexError` exception.
An example that will remove *remove_this* from email addresses:: | trusted_official_docs | CPython Docs | For example, after ``m = re.search('b(c?)', 'cba')``, ``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both 2, and ``m.start(2)`` raises an :exc:`IndexError` exception.
An example that will remove *remove_this* from email addresses:: | For example, after ``m = re.search('b(c?)', 'cba')``, ``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both 2, and ``m.start(2)`` raises an :exc:`IndexError` exception.
An example that will remove *remove_this* from email addresses:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c6ae106-5bac-4201-b00d-49722bc60b81 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,061 | supabase-export-v2 | c2b8bd36224799cd | .. index:: single: \b; in regular expressions
``\b``
Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of word characters. Note that formally, ``\b`` is defined as the boundary
between a ``\w`` and a ``\W`` character (or vice versa),
or between ``\w`` and the begin... | trusted_official_docs | CPython Docs | .. index:: single: \b; in regular expressions
``\b``
Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of word characters. Note that formally, ``\b`` is defined as the boundary
between a ``\w`` and a ``\W`` character (or vice versa),
or between ``\w`` and the begin... | .. index:: single: \b; in regular expressions
``\b``
Matches the empty string, but only at the beginning or end of a word. A word is defined as a sequence of word characters. Note that formally, ``\b`` is defined as the boundary
between a ``\w`` and a ``\W`` character (or vice versa),
or between ``\w`` and the begin... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c7a4140-ef19-48e8-9121-9c86de8328ec | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,095 | supabase-export-v2 | 7b0dd3c67b26979b | ``\Z`` The same as ``\z``. For compatibility with old Python versions.
.. index::
single: \a; in regular expressions
single: \b; in regular expressions
single: \f; in regular expressions
single: \n; in regular expressions
single: \N; in regular expressions
single: \r; in regular expressions
single: \t; in regula... | trusted_official_docs | CPython Docs | ``\Z`` The same as ``\z``. For compatibility with old Python versions.
.. index::
single: \a; in regular expressions
single: \b; in regular expressions
single: \f; in regular expressions
single: \n; in regular expressions
single: \N; in regular expressions
single: \r; in regular expressions
single: \t; in regula... | ``\Z`` The same as ``\z``. For compatibility with old Python versions.
.. index::
single: \a; in regular expressions
single: \b; in regular expressions
single: \f; in regular expressions
single: \n; in regular expressions
single: \N; in regular expressions
single: \r; in regular expressions
single: \t; in regula... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4cd690d7-0314-4e90-9aea-6e030d198462 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,002 | supabase-export-v2 | cc3e436fc128a064 | .. index:: single: \ (backslash); in regular expressions
* Backslash either escapes characters which have special meaning in a set
such as ``'-'``, ``']'``, ``'^'`` and ``'\\'`` itself or signals
a special sequence which represents a single character such as
``\xa0`` or ``\n`` or a character class such as ``\w`` or ... | trusted_official_docs | CPython Docs | .. index:: single: \ (backslash); in regular expressions
* Backslash either escapes characters which have special meaning in a set
such as ``'-'``, ``']'``, ``'^'`` and ``'\\'`` itself or signals
a special sequence which represents a single character such as
``\xa0`` or ``\n`` or a character class such as ``\w`` or ... | .. index:: single: \ (backslash); in regular expressions
* Backslash either escapes characters which have special meaning in a set
such as ``'-'``, ``']'``, ``'^'`` and ``'\\'`` itself or signals
a special sequence which represents a single character such as
``\xa0`` or ``\n`` or a character class such as ``\w`` or ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4d3c0e3d-8697-4465-af94-b95451f5523c | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,327 | supabase-export-v2 | 8a8e0b657c276846 | m.string[m.start(g):m.end(g)]
Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched a
null string. For example, after ``m = re.search('b(c?)', 'cba')``,
``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both
2, and ``m.start(2)`` raises an :exc:`IndexError` exception. | trusted_official_docs | CPython Docs | m.string[m.start(g):m.end(g)]
Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched a
null string. For example, after ``m = re.search('b(c?)', 'cba')``,
``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both
2, and ``m.start(2)`` raises an :exc:`IndexError` exception. | m.string[m.start(g):m.end(g)]
Note that ``m.start(group)`` will equal ``m.end(group)`` if *group* matched a
null string. For example, after ``m = re.search('b(c?)', 'cba')``,
``m.start(0)`` is 1, ``m.end(0)`` is 2, ``m.start(1)`` and ``m.end(1)`` are both
2, and ``m.start(2)`` raises an :exc:`IndexError` exception. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4e7eaab7-afda-40f0-a1dd-d5709c41a2b4 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,045 | supabase-export-v2 | b362039062789c73 | not match at the beginning of the string being searched; you will most likely want to use the :func:`search` function rather than the :func:`match` function:
>>> import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def' | trusted_official_docs | CPython Docs | not match at the beginning of the string being searched; you will most likely want to use the :func:`search` function rather than the :func:`match` function:
>>> import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def' | not match at the beginning of the string being searched; you will most likely want to use the :func:`search` function rather than the :func:`match` function:
>>> import re
>>> m = re.search('(?<=abc)def', 'abcdef')
>>> m.group(0)
'def' | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4e8be4e2-be25-4e9f-83f6-bba31a672fae | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,229 | supabase-export-v2 | e2bc1f2600a68df8 | .. versionchanged:: 3.3 The ``'_'`` character is no longer escaped.
.. versionchanged:: 3.7
Only characters that can have special meaning in a regular expression
are escaped. As a result, ``'!'``, ``'"'``, ``'%'``, ``"'"``, ``','``,
``'/'``, ``':'``, ``';'``, ``'<'``, ``'='``, ``'>'``, ``'@'``, and
``"`"`` are no l... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.3 The ``'_'`` character is no longer escaped.
.. versionchanged:: 3.7
Only characters that can have special meaning in a regular expression
are escaped. As a result, ``'!'``, ``'"'``, ``'%'``, ``"'"``, ``','``,
``'/'``, ``':'``, ``';'``, ``'<'``, ``'='``, ``'>'``, ``'@'``, and
``"`"`` are no l... | .. versionchanged:: 3.3 The ``'_'`` character is no longer escaped.
.. versionchanged:: 3.7
Only characters that can have special meaning in a regular expression
are escaped. As a result, ``'!'``, ``'"'``, ``'%'``, ``"'"``, ``','``,
``'/'``, ``':'``, ``';'``, ``'<'``, ``'='``, ``'>'``, ``'@'``, and
``"`"`` are no l... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
514e41b1-f83f-43c3-9466-739866834dac | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,351 | supabase-export-v2 | 9fdce01c0db4f0e6 | "a" for ace, "k" for king, "q" for queen, "j" for jack, "t" for 10, and "2" through "9" representing the card with that value.
To see if a given string is a valid hand, one could do the following:: | trusted_official_docs | CPython Docs | "a" for ace, "k" for king, "q" for queen, "j" for jack, "t" for 10, and "2" through "9" representing the card with that value.
To see if a given string is a valid hand, one could do the following:: | "a" for ace, "k" for king, "q" for queen, "j" for jack, "t" for 10, and "2" through "9" representing the card with that value.
To see if a given string is a valid hand, one could do the following:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
51a8c903-33a5-4f61-9f32-eeeffc4644f8 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,292 | supabase-export-v2 | b533ace2beccfba6 | ``True``. Since :meth:`~Pattern.match` and :meth:`~Pattern.search` return ``None`` when there is no match, you can test whether there was a match with a simple ``if`` statement::
if match := re.search(pattern, string):
process(match) | trusted_official_docs | CPython Docs | ``True``. Since :meth:`~Pattern.match` and :meth:`~Pattern.search` return ``None`` when there is no match, you can test whether there was a match with a simple ``if`` statement::
if match := re.search(pattern, string):
process(match) | ``True``. Since :meth:`~Pattern.match` and :meth:`~Pattern.search` return ``None`` when there is no match, you can test whether there was a match with a simple ``if`` statement::
if match := re.search(pattern, string):
process(match) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
520032c5-d562-4322-a2fc-664d1dc47120 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,265 | supabase-export-v2 | c9637436671f5de4 | .. method:: Pattern.match(string[, pos[, endpos]])
.. soft-deprecated:: 3.15
:meth:`~Pattern.match` has been :term:`soft deprecated` in favor of
the alternate :meth:`~Pattern.prefixmatch` name of this API which is
more explicitly descriptive. Use it to
better express intent. The norm in other languages and regular ... | trusted_official_docs | CPython Docs | .. method:: Pattern.match(string[, pos[, endpos]])
.. soft-deprecated:: 3.15
:meth:`~Pattern.match` has been :term:`soft deprecated` in favor of
the alternate :meth:`~Pattern.prefixmatch` name of this API which is
more explicitly descriptive. Use it to
better express intent. The norm in other languages and regular ... | .. method:: Pattern.match(string[, pos[, endpos]])
.. soft-deprecated:: 3.15
:meth:`~Pattern.match` has been :term:`soft deprecated` in favor of
the alternate :meth:`~Pattern.prefixmatch` name of this API which is
more explicitly descriptive. Use it to
better express intent. The norm in other languages and regular ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5410f8e4-e5e5-4c65-a6ad-c20d3418c8b6 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,319 | supabase-export-v2 | ef23b4d99bc7ffe6 | >>> m = re.search(r"(\d+)\.(\d+)", "24.1632") >>> m.groups() ('24', '1632')
If we make the decimal place 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:: | trusted_official_docs | CPython Docs | >>> m = re.search(r"(\d+)\.(\d+)", "24.1632") >>> m.groups() ('24', '1632')
If we make the decimal place 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.1632") >>> m.groups() ('24', '1632')
If we make the decimal place 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:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55c76d8a-1b6a-45bf-9405-f93bff408381 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,301 | supabase-export-v2 | ddb26db4c7cd1e50 | corresponding result is ``None``. If a group is contained in a part of the pattern that matched multiple times, the last match is returned. ::
>>> m = re.search(r"\A(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m.group(0) # The entire match
'Norwegian Blue'
>>> m.group(1) # The first parenthesized subgr... | trusted_official_docs | CPython Docs | corresponding result is ``None``. If a group is contained in a part of the pattern that matched multiple times, the last match is returned. ::
>>> m = re.search(r"\A(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m.group(0) # The entire match
'Norwegian Blue'
>>> m.group(1) # The first parenthesized subgr... | corresponding result is ``None``. If a group is contained in a part of the pattern that matched multiple times, the last match is returned. ::
>>> m = re.search(r"\A(\w+) (\w+)", "Norwegian Blue, pining for the fjords")
>>> m.group(0) # The entire match
'Norwegian Blue'
>>> m.group(1) # The first parenthesized subgr... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
55df17c1-ee24-44e1-bae3-4bcb8275b597 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,196 | supabase-export-v2 | b4761082e6f3c968 | 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).
.. versionchanged:: 3.7
Non-empty matches can now start just after a previous empty match. | trusted_official_docs | CPython Docs | 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).
.. versionchanged:: 3.7
Non-empty matches can now start just after a previous empty match. | 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).
.. versionchanged:: 3.7
Non-empty matches can now start just after a previous empty match. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5720dc57-3af0-4d68-a103-5c6bb6e3a055 | CPython Docs | file://datasets/cpython/Doc/library/re.rst | unknown | 7e452c1f-1cda-46ff-a4db-79992d398fb2 | 51,160 | supabase-export-v2 | e333ad1c4fd3d1f9 | .. note::
The compiled versions of the most recent patterns passed to
:func:`re.compile` 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. | trusted_official_docs | CPython Docs | .. note::
The compiled versions of the most recent patterns passed to
:func:`re.compile` 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. | .. note::
The compiled versions of the most recent patterns passed to
:func:`re.compile` 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. | 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.