Ruby v1.91 won't match literal plus sign

P

Paul Taylor

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.
 
R

Rob Biedenharn

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 Biedenharn
(e-mail address removed) http://AgileConsultingLLC.com/
(e-mail address removed) http://GaslightSoftware.com/
 
B

bbiker

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,434
Messages
2,571,690
Members
48,796
Latest member
Greg L.

Latest Threads

Top