----- Original Message ----- From: "John W. Krahn" <jwkr...@shaw.ca>
To: "Perl Beginners" <beginners@perl.org>
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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to