I should have noted, I'm not using Javascript for the actual code part. I was just asking this learned community for input on the regex portion.
The .? will match 0 or 1 periods. In some cases, there will not be a period: Yahoo! Slurp is a good example. -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Flesler Sent: Friday, October 26, 2007 8:35 AM To: jQuery (English) Subject: [jQuery] Re: Best regex for this, getting software version numbers Shouldn't that be: [^.]+\.[^.]+ ? He didn't say he want to capture the first part, and '.?' will match something else. Just in case you are interested, you can achieve the same using: s.substring( 0, s.indexOf( '.' ,s.indexOf('.')+1 )); Ariel Flesler On Oct 25, 10:05 pm, "Andy Matthews" <[EMAIL PROTECTED]> wrote: > That's better than mine (or at least shorter). Thanks! > > _____ > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] > On Behalf Of Michael Geary > Sent: Thursday, October 25, 2007 4:52 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: Best regex for this, getting software version > numbers > > Call me stupid. You did provide exactly the information I was asking > for in my other message, I was just not paying close enough attention. D'oh! > > You could probably simplify the RE to this: > > ([^.]+).?[^.]+ > > -Mike > > _____ > > From: Andy Matthews > I came up with this: > > ([a-zA-Z0-9 !]+).?([a-zA-Z0-9]+) > > Is there a better way to do this? > > _____ > > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] > On Behalf Of Andy Matthews > Sent: Thursday, October 25, 2007 4:32 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Best regex for this, getting software version > numbers > > I have these strings: > > Firefox 2.0.0.8 (Firefox 2.0) > > Internet Explorer 7.0 (Internet Explorer 7.0) > > Googlebot 2.1 (Googlebot 2.1) > > Yahoo! Slurp (Yahoo! Slurp) > > etc. > > I'd like to grab everything up to a second period (if it exists). What > I want is in parens next to each string. > > Anyone have any ideas? > > ____________________________________ > > Andy Matthews > Senior ColdFusion Developer > > Office: 877.707.5467 x747 > Direct: 615.627.9747 > Fax: 615.467.6249 > [EMAIL PROTECTED]<http://www.dealerskins.co > m/> > > atte6357.bmp > 6KDownload