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 [[:blank:]], but in this case probably "\ " or
"[ ]".

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to