regular expression - matches

John Salerno johnjsal at NOSPAMgmail.com
Fri Jul 21 11:50:38 EDT 2006


Simon Forman wrote:

> Python's re.match() matches from the start of the string, so if you
> want to ensure that the whole string matches completely you'll probably
> want to end your re pattern with the "$" character (depending on what
> the rest of your pattern matches.)

Is that necessary? I was thinking that match() was used to match the 
full RE and string, and if they weren't the same, they wouldn't match 
(meaning a begin/end of string character wasn't necessary). That's wrong?



More information about the Python-list mailing list