[issue16203] Proposal: add re.fullmatch() method

2013-11-23 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: open -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https:/

[issue16203] Proposal: add re.fullmatch() method

2013-11-23 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- resolution: -> fixed stage: patch review -> committed/rejected ___ Python tracker ___ ___ Python-bug

[issue16203] Proposal: add re.fullmatch() method

2013-11-23 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Committed with additional test (re.fullmatch('a+', 'ab')) which proves that change for SRE_OP_REPEAT_ONE are needed. Thank you Matthew for your contribution. -- ___ Python tracker

[issue16203] Proposal: add re.fullmatch() method

2013-11-23 Thread Roundup Robot
Roundup Robot added the comment: New changeset 89dfa2671c83 by Serhiy Storchaka in branch 'default': Issue #16203: Add re.fullmatch() function and regex.fullmatch() method, http://hg.python.org/cpython/rev/89dfa2671c83 -- ___ Python tracker

[issue16203] Proposal: add re.fullmatch() method

2013-11-23 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- assignee: -> serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue16203] Proposal: add re.fullmatch() method

2013-11-16 Thread Matthew Barnett
Matthew Barnett added the comment: I don't know that it's not needed. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsu

[issue16203] Proposal: add re.fullmatch() method

2013-11-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Matthew, could you please answer my question? -- ___ Python tracker ___ ___ Python-bugs-list maili

[issue16203] Proposal: add re.fullmatch() method

2013-10-26 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Patch updated to current tip. I have added some changes from the review and have added some tests. Matthew, why change for SRE_OP_REPEAT_ONE is needed? Tests are passed without it. -- ___ Python tracker

[issue16203] Proposal: add re.fullmatch() method

2013-10-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- keywords: -easy ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue16203] Proposal: add re.fullmatch() method

2013-10-26 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : Added file: http://bugs.python.org/file32370/issue16203_mrab_3.patch ___ Python tracker ___ ___ Python-bugs-list

[issue16203] Proposal: add re.fullmatch() method

2013-10-13 Thread Nick Coghlan
Changes by Nick Coghlan : -- stage: committed/rejected -> patch review ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubs

[issue16203] Proposal: add re.fullmatch() method

2013-10-13 Thread Georg Brandl
Georg Brandl added the comment: Sorry, accidental push, already reverted. -- resolution: fixed -> status: closed -> open ___ Python tracker ___ _

[issue16203] Proposal: add re.fullmatch() method

2013-10-13 Thread Roundup Robot
Roundup Robot added the comment: New changeset b51218966201 by Georg Brandl in branch 'default': Add re.fullmatch() function and regex.fullmatch() method, which anchor the http://hg.python.org/cpython/rev/b51218966201 -- nosy: +python-dev resolution: -> fixed stage: patch review -> comm

[issue16203] Proposal: add re.fullmatch() method

2013-10-13 Thread Georg Brandl
Georg Brandl added the comment: I updated the patch to current tip, fixed three issues from the review, and added documentation updates. -- nosy: +georg.brandl Added file: http://bugs.python.org/file32076/issue16203_mrab_2.patch ___ Python tracker <

[issue16203] Proposal: add re.fullmatch() method

2013-10-12 Thread Antoine Pitrou
Antoine Pitrou added the comment: Serhiy, sorry to ping you, but do you think you're gonna look at this? -- ___ Python tracker ___ ___

[issue16203] Proposal: add re.fullmatch() method

2013-02-06 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I can't comment right now, but I am going inspect thoroughly re internals. This is a new feature and we have enough time before 3.4 freeze. -- ___ Python tracker ___

[issue16203] Proposal: add re.fullmatch() method

2013-02-06 Thread Antoine Pitrou
Antoine Pitrou added the comment: > 3 of the tests expect None when using 'fullmatch'; they won't return > None when using 'match'. Sorry, my bad. Like Serhiy, I can't comment on the changes to re internals, but we can trust you on this. The patch needs documentation, though. --

[issue16203] Proposal: add re.fullmatch() method

2013-02-05 Thread Matthew Barnett
Matthew Barnett added the comment: 3 of the tests expect None when using 'fullmatch'; they won't return None when using 'match'. -- ___ Python tracker ___ __

[issue16203] Proposal: add re.fullmatch() method

2013-02-05 Thread Antoine Pitrou
Antoine Pitrou added the comment: The patch doesn't seem to include failure cases for fullmatch (i.e. cases where fullmatch returns None where match or search would return a match). -- ___ Python tracker _

[issue16203] Proposal: add re.fullmatch() method

2013-02-05 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: I did not analyze the patch deeply, only left on Rietveld comments on first sight. Need to update the documentation. -- ___ Python tracker __

[issue16203] Proposal: add re.fullmatch() method

2013-02-04 Thread Matthew Barnett
Matthew Barnett added the comment: I've attached a patch. -- Added file: http://bugs.python.org/file28955/issue16203_mrab.patch ___ Python tracker ___ ___

[issue16203] Proposal: add re.fullmatch() method

2012-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Thanks for the patch. While an internal flag may be a reasonable implementation strategy, IMHO a dedicated method still makes sense: it's simply more readable than passing a flag. As for the tests, they should probably exercise the interaction with re.MULTILI

[issue16203] Proposal: add re.fullmatch() method

2012-11-27 Thread Ezra Berch
Ezra Berch added the comment: Patch attached. I've taken a slightly different approach than what has been discussed here: rather than define a new fullmatch() function and method, I've defined a new re.FULLMATCH flag for match(). So an example would be re.match('abc','abc',re.FULLMATCH) The i

[issue16203] Proposal: add re.fullmatch() method

2012-11-12 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- stage: -> needs patch ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://

[issue16203] Proposal: add re.fullmatch() method

2012-10-18 Thread Ezio Melotti
Changes by Ezio Melotti : -- components: +Regular Expressions nosy: +ezio.melotti ___ Python tracker ___ ___ Python-bugs-list mailing

[issue16203] Proposal: add re.fullmatch() method

2012-10-17 Thread Antoine Pitrou
Antoine Pitrou added the comment: FWIW, I prefer "fullmatch" as well :) -- ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Matthew Barnett
Matthew Barnett added the comment: OK, in order to avoid bikeshedding, "fullmatch" it is. -- ___ Python tracker ___ ___ Python-bugs-li

[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Guido van Rossum
Guido van Rossum added the comment: But my other argument stands. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscr

[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Matthew Barnett
Matthew Barnett added the comment: re2's FullMatch method contrasts with its PartialMatch method, which re doesn't have! -- ___ Python tracker ___ __

[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Guido van Rossum
Guido van Rossum added the comment: re.matchall() would appear to be related to re.findall(), which it isn't. The re2 package has a FullMatch method: http://code.google.com/p/re2/wiki/CplusplusAPI -- ___ Python tracker

[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Tim Peters
Tim Peters added the comment: I like "matchall" fine, but I can't channel Guido on names - he sometimes gets those wrong ;-) -- ___ Python tracker ___ __

[issue16203] Proposal: add re.fullmatch() method

2012-10-16 Thread Matthew Barnett
Matthew Barnett added the comment: I'm about to add this to my regex implementation and, naturally, I want it to have the same name for compatibility. However, I'm not that keen on "fullmatch" and would prefer "matchall" instead. What do you think? --

[issue16203] Proposal: add re.fullmatch() method

2012-10-13 Thread Matthew Barnett
Matthew Barnett added the comment: It certainly appears to ignore the whitespace, even if the "(?x)" is at the end of the pattern or in the middle of a group. Another point we need to consider is that the user might want to use a pre-compiled pattern. -- _

[issue16203] Proposal: add re.fullmatch() method

2012-10-13 Thread Tim Peters
Tim Peters added the comment: Serhiy, I expect this is easy to implement _inside_ the regexp engine. The complications come from trying to do it outside the engine. But even there, wrapping the original regexp in (?:)\Z is at worst very close. The only insecurity with that I've thought of

[issue16203] Proposal: add re.fullmatch() method

2012-10-13 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Definitely this is not easy issue. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Uns

[issue16203] Proposal: add re.fullmatch() method

2012-10-13 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Tim, my point is that if the MULTILINE flag happens to be turned on, > '$' won't just match at the end of the string (or slice), it'll also > match at a newline, so wrapping the pattern in (?:...)$ in that case > could give the wrong answer, but wrapping it in

[issue16203] Proposal: add re.fullmatch() method

2012-10-13 Thread Matthew Barnett
Matthew Barnett added the comment: Tim, my point is that if the MULTILINE flag happens to be turned on, '$' won't just match at the end of the string (or slice), it'll also match at a newline, so wrapping the pattern in (?:...)$ in that case could give the wrong answer, but wrapping it in (?:.

[issue16203] Proposal: add re.fullmatch() method

2012-10-12 Thread Tim Peters
Tim Peters added the comment: Matthew, Guido wrote "check that the whole input string matches" (or slice if pos and (possibly also) endpos is/are given). So, yes, \Z is more to the point than $ if people want to continue wasting time trying to implement this as a Python-level function ;-) I

[issue16203] Proposal: add re.fullmatch() method

2012-10-12 Thread Matthew Barnett
Matthew Barnett added the comment: '$' will match at the end of the string or just before the final '\n': >>> re.match(r'abc$', 'abc\n') <_sre.SRE_Match object at 0x00F15448> So shouldn't you be using r'\Z' instead? >>> re.match(r'abc\Z', 'abc') <_sre.SRE_Match object at 0x00F15410> >>> re.mat

[issue16203] Proposal: add re.fullmatch() method

2012-10-11 Thread Tim Peters
Tim Peters added the comment: Antoine, that's certainly the conceptual intent here. Can't say whether your attempt works in all cases. The docs don't guarantee it. For example, if the original regexp started with (?x), the docs explicitly say the effect of (?x) is undefined "if there are no

[issue16203] Proposal: add re.fullmatch() method

2012-10-11 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Note that this really can't be done in user-level code. Well, how about: def fullmatch(regex, input, flags=0): return re.match("(:?" + regex + ")$", input, flags) -- nosy: +pitrou ___ Python tracker

[issue16203] Proposal: add re.fullmatch() method

2012-10-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: What will be with non-greedy qualifiers? Should '.*?' full match any string? >>> re.match('.*?$', 'abc').group() 'abc' >>> re.match('.*?', 'abc').group() '' -- nosy: +serhiy.storchaka ___ Python tracker

[issue16203] Proposal: add re.fullmatch() method

2012-10-11 Thread Tim Peters
Tim Peters added the comment: +1. Note that this really can't be done in user-level code. For example, consider matching the pattern a|ab against the string ab Without being _forced_ to consider the "ab" branch, the regexp will match just the "a" branch. So, e.g., the example code you po

[issue16203] Proposal: add re.fullmatch() method

2012-10-11 Thread Guido van Rossum
New submission from Guido van Rossum: I've noticed a subtle bug in some of our internal code. Someone wants to ensure that a certain string (e.g. a URL path) matches a certain pattern in its entirety. They use re.match() with a regex ending in $. Fine. Now someone else comes along and modi