Dec 6, 2000, 9:49 AM
Post #4 of 6
No Problem Japhy, I'll help out :),
\d means all numeric characters,
$ means to the end of the string
Putting the \d in () can be used to save everything that the \d applies to and store it into $1. Like so,
If you want to find all the numbers in a string and put say ... brackets around them, this will do it,
$string =~ s/(\d+)/[$1]/;
Now as for that +, it is a qualifier, and it tells \d how far it should go, \d by itself will only apply to the first number it finds, but \d+ will apply to the first group of numbers it finds, because the + means 1 or more.
When you put the $ after the (\d+) it tells the \d to grab the group of numbers at the end of the string.
Does that clear it up?