- Original Message -
From: "John W. Krahn"
To: "Perl Beginners"
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
Irfan Sayed wrote:
Still i am not getting proper result. Here is my code. please help.
$string = "pqp-un_1.0G_2009-02-23_17-38-09_5678903.txt";
$string = ( split /\D+/ )[ -1 ];
$string = ( split /\D+/, $string )[ -1 ];
print "$string\n";
John
--
Those people who think they know everyt
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
$ perl -le'
$_ = "pqp-un_1.0G_2009-02-23_17-38-09_5678903.txt ";
p
Hi All,
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
please please help.
Regards
Irfan.
I'd probably do it as:
s/(\..*?)\z//;
Cheers,
D.
On Feb 11, 2008 7:14 AM, <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
> that I want to remove last dot (.) and all the characters/digit after
> that dot with the help of regular exp
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
If after last dot(.) there are three digit then don't do
an
[EMAIL PROTECTED] wrote:
From: John W. Krahn [mailto:[EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
$ perl
To reuse some code...
$ perl -le'
$_ = "D.PRS.WEB.02.10.001.1";
print;
s/\.[^.]{0,2}\z//;
s/\.[^.]{4,}\z//;
print;
'
Will replace 0 to 2 or more than 3 characters with ""
To get digits and not "any character except a dot(.)" replace "[^.]"
with "[0-9]" or the equivalents: "\d" and "[:digits:]"
-
ginal Message-
From: John W. Krahn [mailto:[EMAIL PROTECTED]
Sent: Monday, February 11, 2008 6:35 PM
To: Perl Beginners
Subject: Re: regarding regular expression
[EMAIL PROTECTED] wrote:
> Hi All,
Hello,
> I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
> that I
[EMAIL PROTECTED] wrote:
Hi All,
Hello,
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
$ perl -le'
$_ = "D.PRS.WEB.02.10.001.1";
print;
s/\.[^.]*\z//;
pr
Hi All,
I have string like this. D.PRS.WEB.02.10.001.1 and my requirement is
that I want to remove last dot (.) and all the characters/digit after
that dot with the help of regular expression.
Please help.
Regards
Irfan.
Project Lead
TSINDIA - Production Line
Individual Software Solutions -
11 matches
Mail list logo