Odd behaviour from re

Magnus Lie Hetland mlh at idi.ntnu.no
Thu Jun 21 22:48:49 EDT 2001


I'm looping through a string with match - thinking
that if I specify a starting position beyond the end
of the string, no match would be returned... But
the darn thing still matches, and gives me both
a start and an end at position len(string)... Is
this intentional? To me it seems rather
counterintuitive... Of course, when I ask it to match
where there is no string, it may be reasonable to
return a position in the same non-string area, but
that's not how it is with the string-method find...
I know matching and searching are different things
etc. but I still think this is a bit... Odd.

Oh, well...

--

  Magnus Lie Hetland         http://www.hetland.org

 "Reality is that which, when you stop believing in
  it, doesn't go away."           -- Philip K. Dick






More information about the Python-list mailing list