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)."


Ok, the specific case is trivial:

A.gsub( / N /, " (N) " )


But the general case is maddening.  Obviously, I am missing something.



If I try:

B = "x"  # the current thing I want to match and replace

Then:

A.gsub( Regexp.compile(B), " (#{B}) " )  ==> error!

And so on...

How do I get a variable into that seemingly constant regular expression 
field?

TIA,

Dave

-- 
["10110100101101000101000000100010100001100110111010010110001001100000010011000010011101000000010011110010110011100001011010100110001101101001000010010000001001101100011011110110110011100001011010100110001101100000001010110110100001101100011001110100110001101111011010110110010100001100001010100110001001101000011001001110000001000100101010000110000011101001011000100110110011100011010000000100100100101000001010010000000101100010111000101110000011100101110011110100111101000001011011110110101101101010011000001110100001101110011010100110011101001011011010000110110001100111010011000110111101101011011011110100001001101100011011110110110011100001011010100110001101101111010001010000010001001001101010100110001011100000010010000010011101101111011000101110000101101010011001001110000001000100101010101110010001101001111000000100000100101000011011000110110101101010011001001110"].pack("b*")