"Mumia W." schreef:
> Dr.Ruud:
>> Mumia W.:
>>> $str =~ m/^((\d+-\d+|\d+);?)+$/g;
>>>
>>> However, this does not consider 250-100 to be invalid.
>>
>> Nor "10-30-20".
>>
>> What's the g-modifier for?
>>
>> The structure is 'a;b;c;d', the smallest is 'a', so treat the ';' as
>> the start of a
On 07/13/2006 12:47 AM, Dr.Ruud wrote:
"Mumia W." schreef:
Ryan Moszynski:
I need to write some code to allow users to specify which of a whole
bunch of elements(e.g.512/1024) that they want to view. My idea for
how to do this was to have them input a semicolon delimited list, for
example:
On 07/13/2006 12:47 AM, Dr.Ruud wrote:
"Mumia W." schreef:
$str =~ m/^((\d+-\d+|\d+);?)+$/g;
However, this does not consider 250-100 to be invalid.
Nor "10-30-20".
What's the g-modifier for?
The structure is 'a;b;c;d', the smallest is 'a', so treat the ';' as the
start of a trailer.
"Mumia W." schreef:
> Ryan Moszynski:
>> I need to write some code to allow users to specify which of a whole
>> bunch of elements(e.g.512/1024) that they want to view. My idea for
>> how to do this was to have them input a semicolon delimited list, for
>> example:
>>
>> 1-10;25;33;100-250
>>
>>
On 07/12/2006 05:08 PM, Ryan Moszynski wrote:
I need to write some code to allow users to specify which of a whole
bunch of elements(e.g.512/1024) that they want to view. My idea for
how to do this was to have them input a semicolon delimited list, for
example:
1-10;25;33;100-250
i tried usin
Check out the module Set::IntSpan and see if it does what you want.
http://search.cpan.org/dist/Set-IntSpan/IntSpan.pm
On Jul 12, 2006, at 3:08 PM, Ryan Moszynski wrote:
I need to write some code to allow users to specify which of a whole
bunch of elements(e.g.512/1024) that they want to view.
"Ryan Moszynski" schreef:
> 1-10;25;33;100-250
echo '1-10;25;33;100-250' | perl -nle '
/\A\d+(?:-\d+)?(?:;\d+(?:-\d+)?)*\z/ and print "$_ =OK"
'
But that also matches '12-3'.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-
Ryan Moszynski wrote:
> I need to write some code to allow users to specify which of a whole
> bunch of elements(e.g.512/1024) that they want to view. My idea for
> how to do this was to have them input a semicolon delimited list, for
> example:
>
> 1-10;25;33;100-250
>
>
> i tried using this t
Ryan Moszynski wrote:
>
> I need to write some code to allow users to specify which of a whole
> bunch of elements(e.g.512/1024) that they want to view. My idea for
> how to do this was to have them input a semicolon delimited list, for
> example:
>
> 1-10;25;33;100-250
>
>
> i tried using this t
Why not just use split()? Then you can do a simple regex on each
element:
###
use strict;
use warnings;
my $string = '1-10;25;33;1-00-250';
my @array = split(/;/,$string);
foreach my $element(@array){
if($element =~ /^\d+-?\d*?$/){
print "$element => valid\n";
Ryan Moszynski wrote:
> I need to write some code to allow users to specify which of a whole
> bunch of elements(e.g.512/1024) that they want to view. My idea for
> how to do this was to have them input a semicolon delimited list, for
> example:
>
> 1-10;25;33;100-250
You will need more than a r
11 matches
Mail list logo