Commit 1d377712 authored by Ezio Melotti's avatar Ezio Melotti

#25517: merge with 3.5.

parents d4d4f202 84c63e8d
......@@ -1004,17 +1004,18 @@ confusing.
A negative lookahead cuts through all this confusion:
``.*[.](?!bat$).*$`` The negative lookahead means: if the expression ``bat``
``.*[.](?!bat$)[^.]*$`` The negative lookahead means: if the expression ``bat``
doesn't match at this point, try the rest of the pattern; if ``bat$`` does
match, the whole pattern will fail. The trailing ``$`` is required to ensure
that something like ``sample.batch``, where the extension only starts with
``bat``, will be allowed.
``bat``, will be allowed. The ``[^.]*`` makes sure that the pattern works
when there are multiple dots in the filename.
Excluding another filename extension is now easy; simply add it as an
alternative inside the assertion. The following pattern excludes filenames that
end in either ``bat`` or ``exe``:
``.*[.](?!bat$|exe$).*$``
``.*[.](?!bat$|exe$)[^.]*$``
Modifying Strings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment