Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Identical Regexp are not equal to each other #4259
Regardless of how a Regexp is created or what it contains, identical Regexp should always be equal to each other.
The behaviour below turns up in MRI 1.9.3, too, but appears to be gone by 2.0.0:
As you can see, the problem seems to be with Regexp created using the basic slash syntax when the regexp itself also contains a slash.
Ok, so stepping through the parser showed me that it's constructing the
Seems like either the one needs to be escaped or the other needs to be unescaped before constructing the Regexp.
A bit more comparison with MRI:
We produce the same tokens, but when combining those string pieces we seem to be escaping the