| I've fairly sure that I'm correct on the REGEXP syntax of /[0-90-9]/
| which is looking for 2 consecutive numbers in the string.
No, that's looking for a *single* digit. The brackets [ ] define a
character class. You meant /[0-9][0-9]/, which is easier written /\d\d/.
| What's going wrong in the index function above? I should be
| able to use
| a REGEXP for the SUBSTR in the INDEX function shouldn't I?
No, you cannot use a regex with the index function.
| BTW, in case I can do this a better way, what I am trying to do is
| extract any numbers in this string. May be 0, 1 or 2 numbers. Then
| compare the number(s) with a "reference" number.
Yes, there's a better way. Catch the digits with parentheses inside
the regex and evaluate the match in list context to get the result:
-----------------------------------------------------------
$job{Ra} = 'Ra: 45k';
if( ($x) = $job{Ra} =~ /(\d\d)/ ) {
print "the number is: $x\n";
}
else {
print "no number... :-(\n";
}
-----------------------------------------------------------
Hope this helps.
-- Marcus
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]