Bruce Ambraal wrote:
>
> Please explain to me what this code does, here I'm tying to rename files
> in current directory to 1.fil, 2.fil, ...
>
> [snip code]
>
> The complete program is:
>
> #!/usr/local/bin/perl -w
> # first example...
>
> use
riginal Message-
From: Bruce Ambraal [mailto:[EMAIL PROTECTED]]
Sent: 13 February 2002 13:36
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Perl regular expresions HELP!
Please explain to me what this code does, here I'm tying to rename files
in current directory to 1.fil, 2.fil, ...
fo
Please explain to me what this code does, here I'm tying to rename files
in current directory to 1.fil, 2.fil, ...
foreach my $f ( @files ){
if( $f =~ /private/ ){ next; }
chomp $f;
$fil{$f} = 0;
# if we match the extension...
if( $f =~ /\.$extension$/ ){
On Aug 31, agc said:
>so I would like to know wich woud be the reg exp for a case like that
>where are examples? fro a beguinner? can any one give me a hand with
>this? cheers
There are several Perl documents on regexes:
perlrequick
perlretut
perlre
Looking at them in that order sh
I am checkin the reg exp but are there site with examples about them?
like for example I want to find the very first word tha is always in the
next line after a line with only underscores, someting like>
__
hy
so I would like to know wich woud be the reg exp for a case like that..
ok so checking the regexp at perldoc, and trying toundertand this ioen I
geot for
while ($buffer !~ /\s\.\./) ; may be soeting like while buffer is not
containnig spaces followed by 2 dots then do what follows, ok
for
while ($buffer !~/here is the pattern list|list/) may be something like
whi
s@Perl. Org" <[EMAIL PROTECTED]>
Sent: Thursday, August 16, 2001 1:59 PM
Subject: RE: Regular expresions
> The \D switch takes out everything that IS a number. Was the original
> question not that this person wanted to take out everything was IS NOT a
> number?
>
> -O
To: '[EMAIL PROTECTED]'
Subject: RE: Regular expresions
i think the /D switch is best...
$str = 'YD*&h9dhiudhc9s9123abc&&%$&()_#';
print $str, "\n";
$str =~ s/\D//g;
print $str, "\n";
> -Origin