From: Yohanes Santoso Date: 2002-05-31T15:00:23+09:00 Subject: Re: Strange Ruby Regexp bug Sean Russell writes: > This is really bizarre, but it isn't the first time I've seen it. It is > probably going to be impossible to track down. > > I've got the following bit of code in REXML: > > nregexp = /^\s*<\/#{name}\s*>/mu > puts nregexp.inspect > > This is the /only/ puts I have in the program; IE, if I remove this puts, > nothing is printed. During the course of parsing a bunch of stuff, at some > point, this gets printed: > > /(\340\023\010\260\3724\010nk\s*>/mu > Hi Sean, I'm using 1.6.7 too, but I can't reproduce your error: ruby 1.6.7 (2002-03-01) [i686-linux] irb(main):006:0> name="table" "table" irb(main):007:0> nregexp = /^\s*<\/#{name}\s*>/mu /^\s*<\/table\s*>/mu irb(main):008:0> mystr=" " " " irb(main):009:0> puts nregexp.inspect /^\s*<\/table\s*>/mu nil irb(main):010:0> mystr =~ nregexp 0 ## 0 means it matches, nil means it does not match. So, as you can see, there is no exception. I put the above sequence into a file and run it without irb and it still works. YS.