Bug #10539
Updated by nobu (Nobuyoshi Nakada) about 10 years ago
Hello, maybe it is my fault, but I stumble over the fact, that I get a match when I should not (have added a short example). I use an Array to have a list of matching names like: ~~~ruby <pre> a = ['moin','test','whatever'] ~~~ </pre> and when I compare with strings like ~~~ruby <pre> ex_strings = ["TOMATCH moin","SHOULNDTMATCH whatever"] ~~~ </pre> I get with ~~~ruby <pre> str =~ /TOMATCH #{a.join("|")}/ ~~~ </pre> (see attached example) a match for TOMATCH moin as well as SHOULDNTMATCH whatever. I tried it with other versions as well. I tried it with older versions of ruby as well with the same result. Is the use of string Interpolation inside regular expressions problematic? Best regards, Tammo