Message385138
On Sat, Jan 16, 2021 at 08:59:13AM +0000, Serhiy Storchaka wrote:
>
> Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment:
>
> ^ matches not just the beginning of the string. It matches the
> beginning of a line, i.e. an anchor just after '\n'.
Only in MULTILINE mode.
I completely agree that in multiline mode '^a' has to search the entire
string. But in single line mode, if the first character isn't an 'a',
there is no need to continue searching.
As far as I can see from the docs, ^ in single line mode and \A always
should be constant time.
> So the original report is rejected, the behavior is expected and
> cannot be changed. It is not a bug.
I disagree that it is expected behaviour. "Match the start of the
string" cannot possibly match anything except the start of the string,
so who would expect it to keep scanning past the start of the string?
(Multiline mode is, of course, different.) |
|
Date |
User |
Action |
Args |
2021-01-16 10:53:05 | steven.daprano | set | recipients:
+ steven.daprano, serhiy.storchaka, 2d4d |
2021-01-16 10:53:05 | steven.daprano | link | issue42885 messages |
2021-01-16 10:53:05 | steven.daprano | create | |
|