On Tue, January 8, 2008 6:18 am, Yossi Itzkovich wrote:
> I need to build a regex to validate a list of number or ranges, such as
> in giving when sending to printing, for exmaple:
>
> 1,4,6-9,13-15,19
>
>
> Is there a way to do it in one regex ?

But of course:

/^(?:(?:(\d+)-(?=(\d+)(??{$1 >= $2 &&
"(?!)"})))?(\d+)(?:\z|,(?=(\d+)(??{$3 >= $4 && "(?!)"}))))+\z/


_______________________________________________
Perl mailing list
[email protected]
http://perl.org.il/mailman/listinfo/perl

Reply via email to