simple (?) re question

Frederic Laurent laurent8 at sxb.bsf.alcatel.fr
Tue Jul 11 12:39:10 EDT 2000


Hi, I try to have a regular expression that doesn't match if
a filename is composed of "SCCS", so I have


>>> r=re.compile(".*(?!SCCS.*$).*[.]java$")

and then

>>> r.match("/foo/bar/SCCS/s.file.java")
<re.MatchObject instance at 1f9898>

But it's wrong for me ! I was expected this file will not match.

I've got the same problem with an expression wich mustn't match
something that's ending with a java extension


>>> r=re.compile(".*[.](?!java$).*$")

with 2 dot, it doesn't work,

>>> r.match("/foo/bar/SCCS/s.file.java")
<re.MatchObject instance at 1f97e8>

but with only one, it's ok

>>> r.match("/foo/bar/SCCS/file.java")

so, what's the problem ?

thanks in advance,


-- 
Frédéric LAURENT
mailto:frederic.laurent at sxb.bsf.alcatel.fr
Tél : (33) 03 88 55 70 00  poste 57228



More information about the Python-list mailing list