From: Eric Hodel Date: 2003-01-27T16:28:31+09:00 Subject: Re: It would be nice to be able to get a regexes string back... --z4+8/lEcDcG5Ke9S Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Sam Roberts (sroberts@uniserve.com) wrote: >=20 > class Decoder >=20 > FOO =3D %r{foo} > BAR =3D %r{bar} >=20 > FOOBAR =3D %r{#{FOO.regex}|#{BAR.regex}} >=20 > ... >=20 > I'm having to do >=20 > FOO =3D 'foo' >=20 > RE_FOO =3D %r{FOO} >=20 >=20 > So I can use the regex bits in other regexes, and as regexes themselves. >=20 > I'd love any suggestions on a nicer way to do this! [23:27] drbrain@huphu:~/ruby/borges$ ri Regex.source ---------------------------------------------------------- Regexp#source rxp.source -> aString ------------------------------------------------------------------------ Returns the original string of the pattern. /ab+c/ix.source #=3D> "ab+c" --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --z4+8/lEcDcG5Ke9S Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.0 (FreeBSD) iD8DBQE+NN+dMypVHHlsnwQRAi64AKDWWKrZ/QDaTjr+5OBc0z3yQDDQtwCgkTwb OsTV2kNm/HpJKPsRmeqxdCg= =fzUw -----END PGP SIGNATURE----- --z4+8/lEcDcG5Ke9S--