in reply to Re: Matching a range of integers
in thread [untitled node, ID 303225]

Abigail-II, I understand your solution for a variable containing a single digit 1, 2, or 3. However, the 2.14 condition got me wondering how to test at number like that. E.g., how to test that a number of any length contains at least a 1, 2, or 3, but not a decimal point. I've tried everything and I can't decide if it's possible in a regex to say "if this, but not this." Theoretically: 1|2|3 && [^\]. I've tried:
my $string = "278.13"; print "okay\n" if ($string =~ /^1|2|3[^\.]$/);
and a dozen others. No luck.

Replies are listed 'Best First'.
Re: Matching a range of integers
by Abigail-II (Bishop) on Oct 30, 2003 at 13:39 UTC
      Thanks Abigail-II. I need to remember the left to right rule from the Camel book, et al!