From: Matthew Kerwin Date: 2013-01-16T08:36:15+09:00 Subject: Re: regex hostnames? --047d7b2e40b84039e904d35c22e9 Content-Type: text/plain; charset=ISO-8859-1 On 16 January 2013 09:20, Joel Pearson wrote: > > > > s = "host1.temp.temp.com" > > s[/\..*/,1] > > Shouldn't that be s[/\..*/,0] or s[/\..*/] ? > > Or if you don't want the dot: s[/\.(.*)/,1] -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd --047d7b2e40b84039e904d35c22e9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On 16 January 2013 09:20, Joel Pearson &= lt;lists@ruby-for= um.com> wrote:
>
> s =3D "h= ost1.temp.temp.com"
> s[/\..*/,1]

Shouldn't that be s[/\..*/,0] or s[/\..*/] ?


Or if you don't want the dot:

<= div style>=A0 =A0 s[/\.(.*)/,1]=A0


--
=A0 Matthew Kerwin, B.Sc (CompSci) (Hons)
=A0 http://matthew.kerwin.net.au/
=A0 = ABN: 59-013-727-651

=A0 "You'll never find a programming la= nguage that frees
=A0 you from the burden of clarifying your ideas." - xkcd
--047d7b2e40b84039e904d35c22e9--