From: Chad Perrin Date: 2011-08-11T09:44:54+09:00 Subject: Re: Reg Ex Help Required --7JfCtLOvnd9MIVvH Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 11, 2011 at 07:34:54AM +0900, Josh Cheek wrote: >=20 > I'd use split as well, but I'd probably do it like this: >=20 > str =3D "abc =3D 100.300" > variable, value =3D str.split('=3D', 2).map(&:strip) > variable # =3D> "abc" > value # =3D> "100.300" I'd probably use a regex for the split sequence rather than a literal to account for variations in whitespace, rather than a map: variable, value =3D str.split(/\s*=3D\s*/, 2) =2E . . but either way works. --=20 Chad Perrin [ original content licensed OWL: http://owl.apotheon.org ] --7JfCtLOvnd9MIVvH Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (FreeBSD) iEYEARECAAYFAk5DId8ACgkQ9mn/Pj01uKW7PQCgojBKOWYxDsvrABUqXQZzPrwY 5+kAoK7okEUM8dT/NAMFuPkWhbxAZEda =5vtL -----END PGP SIGNATURE----- --7JfCtLOvnd9MIVvH--