classification
Title: Clarify re.search documentation first match
Type: enhancement Stage: resolved
Components: Documentation, Regular Expressions Versions: Python 3.6, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: Joshua.Landau, berker.peksag, docs@python, ezio.melotti, mrabarnett, python-dev, terry.reedy
Priority: normal Keywords:

Created on 2014-05-28 14:39 by Joshua.Landau, last changed 2016-06-08 11:58 by berker.peksag. This issue is now closed.

Messages (6)
msg219270 - (view) Author: Joshua Landau (Joshua.Landau) * Date: 2014-05-28 14:39
The documentation for re.search does not state that it returns the first match. This should be added, or a clarification added if this is implementation-defined.

https://docs.python.org/3/library/re.html#re.search

---

See also

http://stackoverflow.com/questions/23906400/is-regular-expression-search-guaranteed-to-return-first-match
msg219420 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-05-30 19:51
Since I am 99.999% sure that first is intended, I will change 'a location' to 'the first location'.
msg219426 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-05-30 20:20
New changeset f7bb1d73a341 by Terry Jan Reedy in branch '2.7':
Issue #21593: (from StackOverflow) minor doc clarification for re.search.
http://hg.python.org/cpython/rev/f7bb1d73a341

New changeset 6013a112aba0 by Terry Jan Reedy in branch '3.4':
Issue #21593: (from StackOverflow) minor doc clarification for re.search.
http://hg.python.org/cpython/rev/6013a112aba0
msg243187 - (view) Author: Joshua Landau (Joshua.Landau) * Date: 2015-05-14 12:47
This should also be applied to regex.search's docstring.

https://docs.python.org/3.5/library/re.html#re.regex.search
msg267838 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-06-08 11:57
New changeset 48bb48e7499d by Berker Peksag in branch '3.5':
Issue #21593: Clarify that re.search() returns the first match
https://hg.python.org/cpython/rev/48bb48e7499d

New changeset 243b95782059 by Berker Peksag in branch 'default':
Issue #21593: Merge from 3.5
https://hg.python.org/cpython/rev/243b95782059
msg267839 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-06-08 11:58
> This should also be applied to regex.search's docstring.

Done.
History
Date User Action Args
2016-06-08 11:58:29berker.peksagsetstatus: open -> closed

nosy: + berker.peksag
messages: + msg267839

resolution: fixed
stage: commit review -> resolved
2016-06-08 11:57:40python-devsetmessages: + msg267838
2016-01-03 10:16:53ezio.melottisetnosy: + ezio.melotti, mrabarnett
stage: resolved -> commit review

components: + Regular Expressions
versions: - Python 3.4
2015-10-23 13:18:16Joshua.Landausetversions: + Python 3.6
2015-05-14 12:47:21Joshua.Landausetstatus: closed -> open
resolution: fixed -> (no value)
messages: + msg243187
2014-05-31 00:13:26terry.reedysetstatus: open -> closed
resolution: fixed
stage: needs patch -> resolved
2014-05-30 20:20:52python-devsetnosy: + python-dev
messages: + msg219426
2014-05-30 19:51:50terry.reedysetassignee: docs@python -> terry.reedy
type: enhancement
versions: - Python 3.1, Python 3.2, Python 3.3
nosy: + terry.reedy

messages: + msg219420
stage: needs patch
2014-05-28 14:39:26Joshua.Landaucreate