On Tuesday 20 May 2003 8:35 pm, Dave Oshel wrote:
> Pardon the newbie question, but I can't seem to find how to place the
> contents of a variable into the regexp field of a gsub.
>
> That is:
>
> A = "There is an N such that all such N should be in parentheses, so
> replace any N with (N)."

Like this?

"one two three".gsub(/(\w+)/,'(\1)') => "(one) (two) (three)"

-- 
Wesley J. Landaker - wjl / icecavern.net
OpenPGP FP: C99E DF40 54F6 B625 FD48  B509 A3DE 8D79 541F F830