Ruby 1.8.1. RegExp documentation?

V

Viktor Zacek

Greetings!

I'm new to Ruby and also new to RegExp... just as a warning... ;-)

I'm using ruby 1.8.1 on Mac OS X.2.8 and searching for some
understandable documentation about regexp in ruby and regexp in common.
I prefer learning-by-doing, so I found the following URL:
http://www.ntecs.de/old-hp/s-direktnet/ruby/uguide05.html
There is a sample program, that runs fine under ruby 1.6.7, but fails
with the first example (doesn'nt mark anything).

Any hints what changed between 1.6.7 and 1.8.1? Is there any up-to-date
documentation about ruby? 95% are about 1.6.7 and rest is about 1.4...
but where is 1.8.1?


Thanks in advance!
Viktor
 
T

ts

V> There is a sample program, that runs fine under ruby 1.6.7, but fails
V> with the first example (doesn'nt mark anything).

Change

str.gsub! re, "#{st}\\&#{en}"

by

str.gsub!(/#{re}/, "#{st}\\&#{en}")



Guy Decoux
 
V

Viktor Zacek

ts said:
Change

str.gsub! re, "#{st}\\&#{en}"

by

str.gsub!(/#{re}/, "#{st}\\&#{en}")

Great!

Thanks a lot!
Hope I will find such "errors" on my own in a couple of weeks :)

Regards,
Viktor
 

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

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top