From: Wes Oldenbeuving Date: 2007-12-30T23:56:07+09:00 Subject: Re: replace words to be bold for each search word --------------enig49A532EAFF9C9533D359CF59 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > I want to correct myself. It works for every search words, but they hav= e=20 > to be directly after each other. > > It works for example: > text =3D "This is an example text." > search =3D "example text" > # here are "example text" bold >=20 > but not for: > text =3D "This is an example of the text." > search =3D "example text" > # here is only "example" bold >=20 > Any idea? I can not reproduce the behaviour you are getting using my highlight method. Can you post the relevant parts of your (test) code you use to get these results? I added more sentences and another search string and they produce the desired behaviour. I'm testing with ruby 1.8.6p111. ### Code # def highlight # ... text =3D "This is an example of the text." text2 =3D "This is an example text." text3 =3D "This is another text used as an example for testing." search =3D "example text" search2 =3D "test text" puts highlight(text,search) # =3D> This is an example of the text. puts highlight(text2,search) # =3D> This is an example text. puts highlight(text3,search2) # =3D> This is another text used as an example for testing.= ## End code Cheers, Wes --------------enig49A532EAFF9C9533D359CF59 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHd7GH2qpBjwxOjJIRAkeEAJ9rRKnql7RdyvcXInUB2byOg/NjuwCfUh0+ PtoXxHSKhAkS6i7QFTjC0w8= =cB/d -----END PGP SIGNATURE----- --------------enig49A532EAFF9C9533D359CF59--