[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread Eric V. Smith
Eric V. Smith added the comment: Sorry. '\.' will be invalid in the future. I got ahead of myself. $ python3 -Werror -q >>> '\.' File "", line 1 SyntaxError: invalid escape sequence \. Not that it would have affected your issue, so I apologize for the red herring. But "switch to raw

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread brent s.
brent s. added the comment: Oh for pete's sake. I wish I could edit comments. Eric- To make it clear: * VERSION: 2.7.16 (default, Mar 11 2019, 18:59:25) [GCC 8.2.1 20181127] PATTERN: \.*$ BEFORE: a.b WITHOUT: a.b DUMMY: a.bX AFTER: a.b. RSTRIP: a.b == BEFORE: a.b. WITHOUT: a.b DUMMY:

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread brent s.
brent s. added the comment: "'\.' is an invalid escape sequence. Could you try it with a raw string?" Well, a valid regex escape, but right. Point taken. I am under the impression, however, that given the value in ptrn (in example.py) is already a string, it should be interpreted as a raw

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This change was intentional and documented. It fixed old bug in the Python implementation of RE and removed the discrepancy with other RE engines. The pattern r'\.*$' matches not only a sequence of dots at the of the line, but also an empty string at the

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread Eric V. Smith
Eric V. Smith added the comment: '\.' is an invalid escape sequence. Could you try it with a raw string? Also, it's not really clear to me what you're seeing, vs. what you expect to see. For one example that you think is incorrect, could you show what you get vs. what you expect to get?

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread brent s.
brent s. added the comment: WORKAROUND: Obviously, str.rstrip('.') still works, but this is of course quite inflexible compared to a regex pattern. -- ___ Python tracker

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread brent s.
brent s. added the comment: Sorry- by "chokes", I mean "substitutes in multiple replacements". -- ___ Python tracker ___ ___

[issue37594] re does not honor matching trailing multiple periods

2019-07-14 Thread brent s.
New submission from brent s. : (Sorry for the title; not quite sure how to summarize this) SO! Have I got an interesting one for you. ISSUE: In release 3.7.3 (and possibly later), the re module, if one has a string e.g. 'a.b.', a pattern such as '\.*$' will successfully *match* any number of