This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Wrong statement about ^ in howto/regex.rst
Type: Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: docs@python, dojutsu-user, mdk, miss-islington, rhettinger
Priority: normal Keywords: easy, patch

Created on 2018-12-25 22:10 by mdk, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 11944 closed louism, 2019-02-19 18:32
PR 11946 merged rhettinger, 2019-02-19 19:26
PR 11947 merged miss-islington, 2019-02-19 19:32
PR 11948 merged miss-islington, 2019-02-19 19:32
Messages (6)
msg332520 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2018-12-25 22:10
In howto/regex.rst I read:

> '^' outside a character class will simply match the '^' character.

Which looks wrong, '^' is the "begin anchor", it's a metacharacter that typically won't match '^'.

I propose to simply remove the statement, if nobody finds a better idea.
msg332521 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2018-12-25 23:00
The caret has several meanings:

* Generally, it is a beginning of string: r'^bol'

* When MULTILINE is on, it is a beginning of line: r'^bos'

* Escaped with a backslash, it is just a caret: r'a\^b'

* Immediately after a left bracket, it inverts a character set: r'[^aeiou]'

* Elsewhere in brackets, it is just a caret: r'[ab^d]'
msg333060 - (view) Author: Julien Palard (mdk) * (Python committer) Date: 2019-01-05 15:08
yes.
msg336006 - (view) Author: miss-islington (miss-islington) Date: 2019-02-19 19:32
New changeset 3bacf6126522a9b3bcb6be0c4f3ee6a895dfe772 by Miss Islington (bot) (Raymond Hettinger) in branch 'master':
bpo-35584: Clarify role of caret in a class class (GH-11946)
https://github.com/python/cpython/commit/3bacf6126522a9b3bcb6be0c4f3ee6a895dfe772
msg336015 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-02-19 20:25
New changeset bb9ddee3d4e293f0717f8c167afdf5749ebf843d by Raymond Hettinger (Miss Islington (bot)) in branch '3.7':
bpo-35584: Clarify role of caret in a class class (GH-11946) (GH-11947)
https://github.com/python/cpython/commit/bb9ddee3d4e293f0717f8c167afdf5749ebf843d
msg336016 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2019-02-19 20:26
New changeset 6ee41793d2204c54bdf8f477ae61d016a7eca932 by Raymond Hettinger (Miss Islington (bot)) in branch '2.7':
bpo-35584: Clarify role of caret in a class class (GH-11946) (GH-11948)
https://github.com/python/cpython/commit/6ee41793d2204c54bdf8f477ae61d016a7eca932
History
Date User Action Args
2022-04-11 14:59:09adminsetgithub: 79765
2019-02-19 20:26:45rhettingersetstatus: open -> closed
stage: patch review -> resolved
resolution: fixed
versions: - Python 3.6
2019-02-19 20:26:13rhettingersetmessages: + msg336016
2019-02-19 20:25:56rhettingersetmessages: + msg336015
2019-02-19 19:32:43miss-islingtonsetpull_requests: + pull_request11972
2019-02-19 19:32:30miss-islingtonsetpull_requests: + pull_request11971
2019-02-19 19:32:21miss-islingtonsetnosy: + miss-islington
messages: + msg336006
2019-02-19 19:26:43rhettingersetpull_requests: + pull_request11970
2019-02-19 18:32:41louismsetkeywords: + patch
stage: patch review
pull_requests: + pull_request11968
2019-02-19 18:16:41rhettingersetassignee: docs@python -> rhettinger
2019-02-19 16:35:47mdksetkeywords: + easy
2019-02-19 16:35:21mdklinkissue36038 superseder
2019-01-05 15:08:59mdksetmessages: + msg333060
2018-12-25 23:00:42rhettingersetnosy: + rhettinger

messages: + msg332521
versions: - Python 3.4, Python 3.5
2018-12-25 22:10:48mdkcreate