Improve the docs for how to match multi-line hints

See #6692
This commit is contained in:
Kovid Goyal
2023-10-17 15:23:58 +05:30
parent 70a588cb36
commit dc6edf9191

View File

@@ -115,14 +115,16 @@ controls where to display the selected error message, other options are ignored.
--regex --regex
default={default_regex} default={default_regex}
The regular expression to use when option :option:`--type` is set to The regular expression to use when option :option:`--type` is set to
:code:`regex`, in python syntax. If you specify a numbered group in the regular :code:`regex`, in Perl 5 syntax. If you specify a numbered group in the regular
expression, only the group will be matched. This allow you to match text expression, only the group will be matched. This allow you to match text
ignoring a prefix/suffix, as needed. The default expression matches lines. To ignoring a prefix/suffix, as needed. The default expression matches lines. To
match text over multiple lines, you should prefix the regular expression with match text over multiple lines, things get a little tricky, as line endings
:code:`(?ms)`, which turns on MULTILINE and DOTALL modes for the regex engine. are a sequence of zero or more null bytes followed by either a carriage return
If you specify named groups and a :option:`--program`, then the program will be or a newline character. To have a pattern match over line endings you will need to
passed arguments corresponding to each named group of the form match the character set ``[\0\r\n]``. The newlines and null bytes are automatically
:code:`key=value`. stripped from the returned text. If you specify named groups and a
:option:`--program`, then the program will be passed arguments corresponding
to each named group of the form :code:`key=value`.
--linenum-action --linenum-action