[EMAIL PROTECTED] schreef:
> if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
As long as you understand that "\s" matches SPC, TAB, CR, NL and several
other characters, and "\d" matches [0-9] and many other characters, and
how one day that will bite you, feel free to use "\s" and "\d".
(I would use neithe
Thanks really
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 6:31 PM
To: Perl Beginners
Cc: Sayed, Irfan (Cognizant)
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] wrote:
> From: Rob Dixon [mailto:[EMAIL PROTECTED]
>> [EMAIL
[EMAIL PROTECTED] wrote:
> From: Rob Dixon [mailto:[EMAIL PROTECTED]
>> [EMAIL PROTECTED] wrote:
>>>
>>> I have a string and I need to parse that string to check whether it is
>>> in required format or not. I have a Perl script which ask for user
>>> input. I have mentioned in the Perl script that
Dr.Ruud wrote:
> Rob Dixon schreef:
>
>> my $re = qr/^
>> \d+
>> (?:
>>(?:,\d+)* | (?: \d+)*
>> )
>> $/x;
>>
>> chomp (my $input = <>);
>>
>> if ($input =~ $re) {
>> print "ok\n";
>> }
>> else {
>> print "invalid\n";
>> }
>
> One problem: the space in "(?: \d+)*" is eaten by the x-m
, 2008 5:16 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] пишет:
> Because I want comma (,) exactly once
>
> -Original Message-
> From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, O
[EMAIL PROTECTED] пишет:
Because I want comma (,) exactly once
-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 4:41 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.
[EMAIL
Because I want comma (,) exactly once
-Original Message-
From: Vyacheslav Karamov [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 14, 2008 4:41 PM
To: Sayed, Irfan (Cognizant)
Cc: [EMAIL PROTECTED]; beginners@perl.org
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] пишет:
>
[EMAIL PROTECTED] пишет:
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
this what I did.
Hi!
Why have you used {1} quantifier?
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/
if ($trig_np =~ m/\d,{1}\d|\d\s{1}\d/)
this what I did.
-Original Message-
From: Rob Dixon [mailto:[EMAIL PROTECTED]
Sent: Monday, October 13, 2008 6:49 PM
To: Perl Beginners
Cc: Sayed, Irfan (Cognizant)
Subject: Re: Regarding reg. exp.
[EMAIL PROTECTED] wrote:
>
> I have a stri
Rob Dixon schreef:
> my $re = qr/^
> \d+
> (?:
>(?:,\d+)* | (?: \d+)*
> )
> $/x;
>
> chomp (my $input = <>);
>
> if ($input =~ $re) {
> print "ok\n";
> }
> else {
> print "invalid\n";
> }
One problem: the space in "(?: \d+)*" is eaten by the x-modifier.
I would normally use [[:blan
On Mon, Oct 13, 2008 at 2:49 PM, <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
>
>
> I have a string and I need to parse that string to check whether it is
> in required format or not. I have a Perl script which ask for user
> input. I have mentioned in the Perl script that input should be in the
> fol
[EMAIL PROTECTED] wrote:
>
> I have a string and I need to parse that string to check whether it is
> in required format or not. I have a Perl script which ask for user
> input. I have mentioned in the Perl script that input should be in the
> following format.
>
> For example:- 1,2,3 OR 1 2 3
>
[EMAIL PROTECTED] schreef:
> For example:- 1,2,3 OR 1 2 3
I assume it should also work on
132,45,16
but should it also work on
132, 45, 16
or on
0132,-45,16E0,0x03
etc. ?
See Regexp::Common.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL P
Hi All,
I have a string and I need to parse that string to check whether it is
in required format or not. I have a Perl script which ask for user
input. I have mentioned in the Perl script that input should be in the
following format.
For example:- 1,2,3 OR 1 2 3
Which means that delimit
14 matches
Mail list logo