Message338581
| Author | Elias Tarhini |
|---|---|
| Recipients | Elias Tarhini, ezio.melotti, mrabarnett |
| Date | 2019-03-22.02:48:42 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1553222922.33.0.727048855468.issue36397@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
I believe I've found a bug in the `re` module -- specifically, in the 3.7+ support for splitting on zero-width patterns. Compare Java's behavior...
jshell> "1211".split("(?<=(\\d))(?!\\1)(?=\\d)");
$1 ==> String[3] { "1", "2", "11" }
...with Python's:
>>> re.split(r'(?<=(\d))(?!\1)(?=\d)', '1211')
['1', '1', '2', '2', '11']
(The pattern itself is pretty straightforward in design, but regex syntax can cloud things, so to be totally clear: it finds any point that follows a digit and precedes a *different* digit.)
* Tested on 3.7.1 win10 and 3.7.0 linux. |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-03-22 02:48:42 | Elias Tarhini | set | recipients: + Elias Tarhini, ezio.melotti, mrabarnett |
| 2019-03-22 02:48:42 | Elias Tarhini | set | messageid: <1553222922.33.0.727048855468.issue36397@roundup.psfhosted.org> |
| 2019-03-22 02:48:42 | Elias Tarhini | link | issue36397 messages |
| 2019-03-22 02:48:42 | Elias Tarhini | create | |