Steve Nelson wrote: > On 7/14/06, John Fouhy <[EMAIL PROTECTED]> wrote: > > >> It doesn't have to match the _whole_ string. >> > > Ah right - yes, so it doesn't say that it has to end with a b - as per > your comment about ending with $. > The matched portion must end with b, but it doesn't have to coincide with the end of the string. The whole regex must be used for it to match; the whole string does not have to be used - the matched portion can be a substring. > >> If you look at the match object returned, you should se that the match >> starts at position 0 and is four characters long. >> > > How does one query a match object in this way? I am learning by > fiddling interactively. The docs for match objects are here: http://docs.python.org/lib/match-objects.html
match.start() and match.end() will tell you where it matched. You might like to try the regex demo that comes with Python; on Windows it is installed at C:\Python24\Tools\Scripts\redemo.py. It gives you an easy way to experiment with regexes. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor