Regular expression to match a #
duncan.booth at invalid.invalid
Fri Aug 12 09:49:24 CEST 2005
John Machin wrote:
>> Your wording makes it hard to distinguish what exactly is "dopey".
> dopey implementations of search() (which apply match() at offsets 0, 1,
> 2, .....).
> The "dopiness" is that the ^ operator means that the pattern cannot
> possibly match starting at 1, 2, 3, etc but a non-optimised search will
> not recognise that and will try all possibilities, so the failing case
> takes time dependant on the length of the string.
The ^ operator can match at any position in the string if the preceding
character was a newline. 'Dopey' would be failing to take this into
More information about the Python-list