Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)

by gman (Friar)
on Oct 09, 2005 at 22:44 UTC ( [id://498692]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re^3: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)
in thread Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)

The input will be constrained and only allow ".." "," and digits.
And the digits will only be positive whole numbers.
I have not worked out the regex for this,
but yours is a starting point.

And thank you for the explaination of your solution!
  • Comment on Re^4: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)

Replies are listed 'Best First'.
Re^5: Iterate string like, for(1..5) i.e. $stirng="1..5"; for($string)
by GrandFather (Saint) on Oct 09, 2005 at 23:08 UTC

    This may be of interest:

    my @ranges = ('2..5,10..15', '2..5', 'die', '-2..5,10..15'); my $match = qr /^\d+\.{2}\d+(,\d+\.{2}\d+)*/; print ((m|$match| ? "ok: " : "Rejected: ") . "$_\n") for (@range +s);

    No need to throw out the eval through pathalogical fear when validating the data in a simple fashion removes the danger of an exploit.


    Perl is Huffman encoded by design.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://498692]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.