That got me started. I do have a question though about your regex.
Good, better to ask and know, I think. Let's see if we can clear it up...
This backreference is $1, and matches the team abbreviation. ([A-Z0-9 -]+)
This one is $2, and matches the first name: (\w+)
Full marks to here. You're right and right.
And this one I'd think should be $3, and match Steal or Assist etc., but the results don't say that.
(?:Steal|Assist|Block|replaced by)
Stuart, I love your questions. ;) You're always missing one tiny piece of knowledge and you always ask them in such a way that I know exactly what it is. Here's the missing piece this time:
You see that the above is surrounded by ( ) and you think that means it should capture. The truth is that the above is surrounded by (?: ), which happens to be ( )'s cousin. It groups things together, like ( ), but it does not capture. I had to cluster them so the |s would work, but I didn't need to hang onto the results, so I chose (?: ) over ( ).
You could do it just fine with normal parenthesis, if you prefer. If you do, you just have to remember that your third answer is in $4, because $3 is holding some junk. Take your pick.
Instead, $3 is this, and matches the second name. (\w+)
If backreferences are supposed to be in parentheses, why isn't this (?:Steal|Assist|Block|replaced by) a backreference?
I'm hoping this makes sense now. There are only three captures in my regex. (\w+) is the third. Can you see that now?
James
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>