From: "David A. Black" Date: 2008-06-21T16:50:41+09:00 Subject: Re: RegEx Hi -- On Sat, 21 Jun 2008, Justin To wrote: > > > Wonderful help guys! > > One other question related to that last bit: > > match(/(v4.|v 4.|-4-/)) > > Would this also match the '(' and ')' ? Or are the parentheses grouping > the items in this case? They're grouping items. (And see Wayne's correction.) The hard thing about character classes: /abc[def]/ is that the character class itself takes up horizontal space on your screen, but it actually only represents one character in the string, in the case a 'd', 'e', or 'f'. It's almost like a vertical construct, like a slot machine: [d] /abc[e]/ [f] where only one of the values described in the character class is actually going to match. Of course, if you have a modifier like +: /abc[def]+/ then the + means that the character class can match more than once. But each time it matches, it's still only consuming one character in the string. David -- Rails training from David A. Black and Ruby Power and Light: ADVANCING WITH RAILS June 16-19 Berlin ADVANCING WITH RAILS July 21-24 Edison, NJ See http://www.rubypal.com for details and updates!