Karl,
From my limited understanding of Python, the regular expression has to
match the entire input, partial matches don't count. The method search
(I believe it's search, I know there is another similar method) is grep
like, and behaves the way you describe. Basically match prepends ^, and
appends $ after the regex if I understand correctly.
If I don't, I'm sure 3 people will correctly :-) This bites me
everytime I use it, so I've learned, that search is what I want, and
match isn't.
Kirby
On Fri, 2002-12-06 at 17:07, Karl Fogel wrote:
> Matt Kraai <kraai@alumni.cmu.edu> writes:
> > I think using match implies a leading "^":
> >
> > If zero or more characters at the beginning of string match the
> > regular expression pattern, return a corresponding MatchObject
> > instance.[1]
>
> You're right:
>
> $ python2
> Python 2.1 (#1, Apr 21 2001, 18:56:55)
> [GCC 2.96 20000731 (Red Hat Linux 7.0)] on linux2
> Type "copyright", "credits" or "license" for more information.
> >>> import re
> >>> re.match("newfile", "newfile")
> <SRE_Match object at 0x81300b0>
> >>> re.match("newfile", " newfile")
> >>>
>
> Surprising! (To me, anyway).
>
> -K
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
--
Real Programmers view electronic multimedia files with a hex editor.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Dec 7 01:20:29 2002