How do I tell Ruby to use the content of a variable as the pattern,
rather than interpreting the variable name as a literal?
v = "aeiou"
Then, in
"goodness" =~ /[v]/
I'd like v to be interepreted not as a literal but as a variable name.
Thanks
basi
Or more verbosely:
"goodness" =~ Regexp.new("[#{v}]")
enjoy,
.adam
Same as with a string:
"goodness" =~ /[#{v}]/
--
vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
"goodness" =~ /#{v}/
basi