4 ms·
Surprisingly I've found this isn't quite true for match vs. search in python. You would think that searching using a regex starting with a ^ anchor might avoid
by ruste 5y ago
Surprisingly I've found this isn't quite true for match vs. search in python. You would think that searching using a regex starting with a ^ anchor might avoid scanning the whole string but it will do so anyway. It makes a huge performance difference if you miss it.
- bobbylarrybobby 5y agoCould it be looking for a match after every (potential) newline character?
- remram 5y agoOnly if you enable the MULTILINE flag.