Ruby v1.91 won't match literal plus sign

text = “++”
puts “matched plus sign” if text.index(/++/, 0)

Prints nothing. Using Regex.quote produces the same behavior.

A forum registration quiz, “puts ((‘11’ * 2).to_i)/2” also prints
nothing but v1.86 prints 555.

On Aug 30, 2010, at 10:31 AM, Paul T. wrote:

text = “++”
puts “matched plus sign” if text.index(/++/, 0)

Prints nothing. Using Regex.quote produces the same behavior.

A forum registration quiz, “puts ((‘11’ * 2).to_i)/2” also prints
nothing but v1.86 prints 555.

1.9.1 and 1.9.2 both work fine. Perhaps you have a particular bug in
the exact version you have. What does your ruby -v say?

-Rob

Rob B.
[email protected] http://AgileConsultingLLC.com/
[email protected] http://GaslightSoftware.com/

On Aug 30, 10:31 am, Paul T. [email protected] wrote:

text = “++”
puts “matched plus sign” if text.index(/++/, 0)

Prints nothing. Using Regex.quote produces the same behavior.

Works fine with ruby-1.9.1p378 on a Mac

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs