Kristof Bastiaensen wrote: > Hi, > > I am wondering if this is the correct behaviour in gsub: > > "bab".gsub(/(?!a)ab/, "cd") > => "bab" > > shouldn't that be "bcd"? I think /(?!a)ab/ can't match anything. It's saying that the first character after the beginning of the match must not be "a", and the first character of the match must be "a". This is contradictory.