Re: regarding regular expression

2009-02-26 Thread John W. Krahn
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

Re: regarding regular expression

2009-02-26 Thread John W. Krahn
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

Re: regarding regular expression

2009-02-27 Thread itshardtogetone
- 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

Re: regarding regular expression

2008-02-11 Thread David Moreno
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

Re: regarding regular expression

2008-02-11 Thread Gunnar Hjalmarsson
[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

Re: regarding regular expression

2008-02-11 Thread John W. Krahn
[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

Re: regarding regular expression

2008-02-11 Thread yitzle
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:]" -

RE: regarding regular expression

2008-02-11 Thread Irfan.Sayed
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

Re: regarding regular expression

2008-02-11 Thread John W. Krahn
[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