Regex not behaving as expectedby Popcorn Dave (Abbot)
|on Feb 01, 2003 at 00:19 UTC ( #231763=perlquestion: print w/replies, xml )||Need Help??|
Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
I know I'm probably going to slap my forehead after I get a response for this but...
I've got a very simple regex which I want to just pull sequential digits out of a filename which is passed in - e.g. sfytd13.txt should return 13.
I'm using the following code:
Very simple, but the problem is that I'm only getting the '1' back. I realize that if I use parthensis matching $1 will return '013' but I'm curious as to why my code doesn't return 13.
My understanding is that \d+ is going to match a digit followed by any number of digits until I hit a non-digit. What am I missing here? Is something getting clobbered in the assignment?
Thanks in advance!
There is no emoticon for what I'm feeling now.
Back to Seekers of Perl Wisdom