Hello, please can you help me. Is it possible to specify number
matching in a regex, i.e. can you have something like:
my $match =~ m/match_number_if_number_is_less_than_255/
instead of my $match =~ m/(\d{3})/;
if ($1<=255){my @array = @array +$1}?
Well your example is a fairly common one and gets a lot of attention in the Mastering Regular Expressions book (which is excellent), and concludes with:
[01]?\d\d?|2[0-4]\d|25[0-5]
But you should really not just use this willy-nilly, if *you* don't understand it the person coming after you (which might just be you!) won't likely either. So in many cases it is better to know your data, do some pre-parsing then compare numbers using standard arithmetic as you have shown. The real question is "what's wrong with what you have?"
I've been in his position many times before while learning Perl. You see all of these amazing everything-and-the-kitchen-sink one-liners and if your code doesn't turn out like that then you are doing something wrong. Its now obvious to me that this is not true at all, but I believe that a lot of people who are learning Perl think like this.
-- Andrew Gaffney
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]