From: Ross Bamford Date: 2005-12-15T17:57:41+09:00 Subject: Re: regular expressions question On Thu, 15 Dec 2005 03:35:15 -0000, James Edward Gray II wrote: > On Dec 14, 2005, at 6:16 PM, Jeff Wood wrote: > >> You should be able to tell who this message is meant for: > > Yes, I recognize that you are probably speaking at least in part to me, > since I did that in this very thread. You can call me by name if you > like. I'm a big boy and I can take it. ;) > (Sorry, James, I assumed that was directed at me alone) >> PLEASE stop sending out code that uses any of the perl ${x} variables >> ... > > [...] > >> Please teach people to use MatchData objects ... > > I also showed a MatchData example. I think the $1, $2 stuff just hit Jeff's anger button, because I had MatchData down at the bottom of my examples too but it seemed to be missed. > > I've used them a time or two, but honestly, they just don't feel right > to me. I've stopped using the default variable, I'm using a two-space > tab, etc. I'm Ruby assimilated, but I just like the Regexp-linked > variables. > Same here - I like to stick to the convention of whatever language I'm using. To begin with I did use a lot more Perl-like stuff (I started with Ruby using an old Perl book. Don't ask...) but now i'm starting to find the Rubyisms that work for me ($LOAD_PATH instead of $: and so on). It seems sensible to me to save the MatchData stuff for the times when it's needed. Java's regexp support is purely OOP-based (of course, being Java ;)) and I can't remember when I last used it for something simple - it's just nowhere near as convenient as matching a literal regexp and using the numbered variables... Cheers, Ross -- Ross Bamford - rosco@roscopeco.remove.co.uk "\e[1;31mL"