> If I feed it 'jones-123’ it dies with ‘jones, - , 123’ as I expected.
But if I feed it ‘jones-‘ omitting the number on the end, it dies with no
matches at all (or blanks): ‘ , , ‘ and I cannot figure out why it does not
die with ‘jones, -, ' and would appreciate an explanation. Many thanks!
[0-9]+ means at least one digit in range 0-9.
If there is no digit, the string won't match.
You want [0-9]* instead.
--Octavian
- Original Message -
From: Rick T
To: Perl Beginners
Sent: Friday, June 01, 2018 11:54 PM
Subject: difficulty with matching
This is a newbie que
This is a newbie question, I’m sure. But I get perplexed easily!
The follow code segment expects to receive a $student_id consisting of a
surname followed by a hyphen followed by a number. The die is for testing what
I’m doing.
If I feed it 'jones-123’ it dies with ‘jones, - , 123’ as I expect