On Tue, 14 Dec 2004, Gooch, John wrote:
> I am used to ( in Perl ) the entire string being searched for a match
> when using RegExp's. I assumed this was the way Python would do it do,
> as Java/Javascript/VbScript all behaved in this manner. However, I found
> that I had to add ".*" in front of
To: Gooch, John
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Tutor] Regexp Not Matching on Numbers?
I'm not too sure what you are trying to do here, but the re in your code
matches the names in your
example data:
>>> import re
>>> name = 'partners80_access_lo
Max Noel wrote:
On Dec 14, 2004, at 18:15, Gooch, John wrote:
So far I have tried the following regular
expressions:
"\d+"
"\d*"
"\W+"
"\W*"
"[1-9]+"
and more...
I think you have to escape the backslashes.
or use raw strings like r"\d+" which is what is in the sample code...
Kent
_
I'm not too sure what you are trying to do here, but the re in your code matches the names in your
example data:
>>> import re
>>> name = 'partners80_access_log.1102723200'
>>> re.compile(r"([\w]+)").match( name ).groups()
('partners80_access_log',)
One thing that may be tripping you up is that r
On Dec 14, 2004, at 18:15, Gooch, John wrote:
This is weird. I have a script that checks walks through directories,
checks
to see if their name matches a certain format ( regular expression ),
and
then prints out what it finds. However, it refuses to ever match on
numbers
unless the regexp is ".
This is weird. I have a script that checks walks through directories, checks
to see if their name matches a certain format ( regular expression ), and
then prints out what it finds. However, it refuses to ever match on numbers
unless the regexp is ".*". So far I have tried the following regular
exp