Why make it complicated? If your regex is already testing for the presence of the ending digits, just capture them and test for the proper condition.
use strict; use warnings; my $threshold = 4333; while (my $ProdBuild = <DATA>) { chomp $ProdBuild; if ($ProdBuild =~ m/K7000[A-Z]-?[A-Z]{5}-?(\d+)/i and $1 >= $thres +hold) { print "Product match $ProdBuild\n"; } else { print "No match found \n" } } __DATA__ K7000AKNBKQ4333 K7000A-KNBKQ-4333 K7000A-KNBKQ-6801 K7000TKNBKQ7610 K7000AKNBKQ4233 K7000AKNB4333 K7000ANBKQ6845 K7000TKNBKQ-1845
yields:
Product match K7000AKNBKQ4333 Product match K7000A-KNBKQ-4333 Product match K7000A-KNBKQ-6801 Product match K7000TKNBKQ7610 No match found No match found No match found No match found
In reply to Re: Regular expression pattern matching question
by thundergnat
in thread Regular expression pattern matching question
by ramya2005
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |