From: Robert Dober Date: 2006-07-27T17:42:47+09:00 Subject: Positive lookahead in multiline strings (was gsub) ------=_Part_37922_17717000.1153989760879 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I was just rolling my own little thread about gsub ;] and trying to fix my stupid regexen when I came up with the perfect solution to replace the last occurence of a pattern (if it is simple, thus not of any interest to the OP of the OT). Consider this string.reverse.sub("<","").reverse is fast but string.sub(Regexp.new("<(?=3D[^<]*$)", Regexp::MULTILINE), "") is almost three times as fast (to my surprise), only that it does not work if there are newlines in the string, they match $. Is there a way to anchor on the end of the string in multiline strings. Just didn't find it. Ty in advance Robert --=20 Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_37922_17717000.1153989760879--