Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix formatting
  • Loading branch information
hugovk committed Apr 4, 2026
commit 42c474ef8c3045ba962dcfdf64aa5d3cd0df6b36
12 changes: 9 additions & 3 deletions Doc/library/re.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1705,15 +1705,21 @@ expressions.
| ``%x``, ``%X`` | ``[-+]?(0[xX])?[\dA-Fa-f]+`` |
+--------------------------------+---------------------------------------------+

To extract the filename and numbers from a string like ::
To extract the filename and numbers from a string like:

.. code-block:: text

/usr/sbin/sendmail - 0 errors, 4 warnings

you would use a :c:func:`!scanf` format like ::
you would use a :c:func:`!scanf` format like:

.. code-block:: text

%s - %d errors, %d warnings

The equivalent regular expression would be ::
The equivalent regular expression would be:

.. code-block:: text

(\S+) - (\d+) errors, (\d+) warnings

Expand Down