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
default={default_regex}
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
ignoring a prefix/suffix, as needed. The default expression matches lines. To
match text over multiple lines, you should prefix the regular expression with
:code:`(?ms)`, which turns on MULTILINE and DOTALL modes for the regex engine.
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`.
match text over multiple lines, things get a little tricky, as line endings
are a sequence of zero or more null bytes followed by either a carriage return
or a newline character. To have a pattern match over line endings you will need to
match the character set ``[\0\r\n]``. The newlines and null bytes are automatically
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