The /o option to a regular expression says 'do any substitutions once
only'. Thus
for i in 0..5
puts i if 'ab3c' =~ /ab#{i}c/
end
will output '3', while
for i in 0..5
puts i if 'ab3c' =~ /ab#{i}c/o
end
outputs nothing. So far so good.
However, I'd then expect that
a = /ab#{c}d/;
should not evaluate the substitution immediately, but should instead
wait until I use the regexp object 'a'. Instead I get 'undefined
variable 'c''.
Am I expecting too much?
Dave