Yvon Thoraval <yvon.thoravallist / -SUPPRIMEZ-free.fr.invalid> wrote:

> does that means my term isn't an ANSI one or the syntax as changed ?
> tuto is mostly from v 1.4 and i'm using v1.8 under MacOS X.2.6

As far as I know, this warning was added some times ago (in 1.7.x ?)
after a slight semantic change, to make sure users would know about it.
Before, a single character string would be treated as a string, and all
others would be converted to regexp. 

The behavior is now that strings will be strings, and regexp will be
regexp. I expected this warning to go away in 1.8 but looking at ruby
code (string.c) it looks like it will go away in 1.8.1.

So in short, your gsub won't work like you expect here because you pass
it a string when you actually want a regexp.

Replace:

str.gsub! re, "#{st}\\&#{en}"

by:

str.gsub! Regexp.compile(re), "#{st}\\&#{en}"

or

str.gsub! /#{re}/, "#{st}\\&#{en}"

-- 
Luc Heinrich - lucsky / mac.com