Hello --

On Thu, 8 Aug 2002 bbense+comp.lang.ruby.Aug.07.02 / telemark.stanford.edu wrote:

> If you are tracking the cvs version of ruby1.7.2 there has been a
> change in behaviour that affects many libraries. You'll get this
> warning
>
> ../rmail/parser.rb:104: warning: string pattern instead of regexp;
> metacharacters no longer effective
>
> - - Generally, you can fix it by changing code from
> from a quoted string to a regexp. Sometimes however
> the warning is a false positive. My understanding
> was that metacharacters only worked if the string
> was a "single char". You will get this warning for
> strings that are multi-char but contain a \.

In the past, strings longer than one char were treated as regexes:

dblack@laptop:~$ ruby -ve 'p %q{abc.def.ghi}.split(".")'
ruby 1.6.7 (2002-03-01) [i686-linux-gnu]
["abc", "def", "ghi"]
dblack@laptop:~$ ruby -e 'p %q{abc.def.ghi}.split("d..")'
["abc.", ".ghi"]

but now, I believe, all strings are treated as strings:

dblack@laptop:~$ ruby/ruby -ve 'p %q{abc.def.ghi}.split(".")'
ruby 1.7.2 (2002-08-06) [i686-linux]
["abc", "def", "ghi"]
dblack@laptop:~$ ruby/ruby -e 'p %q{abc.def.ghi}.split("d..")'
-e:1: warning: string pattern instead of regexp; metacharacters no
longer effective
["abc.def.ghi"]

I think this means it makes sense for the warning to appear when it
does (but I'm also pretty sure the warning will disappear in 1.8 [?]).


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav