----- Original Message -----
From: "John W. Krahn" <[email protected]>
To: "Perl Beginners" <[email protected]>
Sent: Thursday, February 26, 2009 10:54 PM
Subject: Re: regarding regular expression
Irfan Sayed wrote:
Hi All,
Hello,
I have a string like this "pqp-un_1.0G_2009-02-23_17-38-09_5678903.txt
" now what i need is only all digits before .txt till first underscore.
which means i need only output as 5678903
or try this
#!/usr/bin/perl
use strict;
use warnings;
my $a = 'pqp-un_1.0G_2009-02-23_17-38-09_5678903.txt';
if ($a =~/_(\d+)\.txt/){
print "The wanted digits = $1\n";
}else{
print "unmatch\n";
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/