regex matching question

bullockbefriending bard kinch1967 at gmail.com
Sat May 19 20:18:56 EDT 2007


> Instead of the "or match.group(0) != results" caper, put \Z (*not* $) at
> the end of your pattern:
>     mobj = re.match(r"pattern\Z", results)
>     if not mobj:

as the string i am matching against is coming from a command line
argument to a script, is there any reason why i cannot get away with
just $ given that this means that there is no way a newline could find
its way into my string? certainly passes all my unit tests as well as
\Z. or am i missing the point of \Z ?




More information about the Python-list mailing list