Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
1d377712
Commit
1d377712
authored
Jan 12, 2016
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Plain Diff
#25517: merge with 3.5.
parents
d4d4f202
84c63e8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
Doc/howto/regex.rst
Doc/howto/regex.rst
+4
-3
No files found.
Doc/howto/regex.rst
View file @
1d377712
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment