--fOHHtNG4YXGJ0yqR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Jun 24, 2007 at 05:45:30PM +0900, Daniel Lucraft wrote:
>=20
> irb> str
> =3D> "asdf asdf _asdfasd_ asdf _ash_ h"
> irb> str.gsub(/_([^\s]+)_/, "<i>\\1</i>")
> =3D> "asdf asdf <i>asdfasd</i> asdf <i>ash</i> h"
>=20
> Or if I wanted to be able to have italicised sentences (_word word_) I=20
> might try this:
>=20
> irb> str
> =3D> "asdf asdf _asdf asd_ asdf _ash \nash_ h"
> irb> str.gsub(/_(.+?)_/m, "<i>\\1</i>")
> =3D> "asdf asdf <i>asdf asd</i> asdf <i>ash \nash</i> h"

I like to be very strict with things like quotes (and underscores in this c=
ase), so I would probably use:

irb> str
=3D> "asdf asdf _asdf asd_ asdf _ash \nash_ h"
irb> str.gsub(/_([^_]+)_/, "<i>\\1</i>")
=3D> "asdf asdf <i>asdf asd</i> asdf <i>ash \nash</i> h"

That seems to work like I would expect it to---I'm just coming over from Pe=
rl...

Wyatt

--fOHHtNG4YXGJ0yqR
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFGfp0gC9HSh+NbckoRAh/YAJ4nXPxDUdtIKaGhFX2RhPZn3YoOrQCgmkSx
OChvADZHwTn5QKQIUlH4E6I=
=Sowk
-----END PGP SIGNATURE-----

--fOHHtNG4YXGJ0yqR--

On Sun, Jun 24, 2007 at 05:45:30PM +0900, Daniel Lucraft wrote:
>=20
> irb> str
> =3D> "asdf asdf _asdfasd_ asdf _ash_ h"
> irb> str.gsub(/_([^\s]+)_/, "<i>\\1</i>")
> =3D> "asdf asdf <i>asdfasd</i> asdf <i>ash</i> h"
>=20
> Or if I wanted to be able to have italicised sentences (_word word_) I=20
> might try this:
>=20
> irb> str
> =3D> "asdf asdf _asdf asd_ asdf _ash \nash_ h"
> irb> str.gsub(/_(.+?)_/m, "<i>\\1</i>")
> =3D> "asdf asdf <i>asdf asd</i> asdf <i>ash \nash</i> h"

I like to be very strict with things like quotes (and underscores in this c=
ase), so I would probably use:

irb> str
=3D> "asdf asdf _asdf asd_ asdf _ash \nash_ h"
irb> str.gsub(/_([^_]+)_/, "<i>\\1</i>")
=3D> "asdf asdf <i>asdf asd</i> asdf <i>ash \nash</i> h"

That seems to work like I would expect it to---I'm just coming over from Pe=
rl...

Wyatt
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQFGfp0gC9HSh+NbckoRAh/YAJ4nXPxDUdtIKaGhFX2RhPZn3YoOrQCgmkSx
OChvADZHwTn5QKQIUlH4E6I=
=Sowk
-----END PGP SIGNATURE-----