in reply to Yet another regex question
Are you sure the LHS should be the substr and not $acct_trtmt_hsty ? You may also want a strict regex:if (substr($acct_trtmt_hsty,1,1) =~ m/([789])/) { print "the number is: " . $1; }
Substitution example (subtracts 4 from every number):my @numbers = $acct_trtmt_hsty =~ m/'([789])'/g; print join ":", @numbers;
$acct_trtmt_hsty, =~ s/(')([789])(')/$1 . ($2-4) . $3/eg; # note: ma +ny different ways to write this regex
|
|---|