replace a string with content from another file

Hi,
I'm a newbi in shell script. Here what I want to do:

FileA:
bor bor bor
xxxx
bib bib bi

FileB:

something something
something

I want to replace string "xxxx" in FileA with contents of FileB.
i tried with sed:

fileb=`cat FileB`
reg=xxxx
file=FileA

sed -e "s+$reg+$fileb+g" $file

but it said:
sed: Function s+reg+ cannot be parsed.

thanks,

while a shell solution is on the way , here is an alternative, in Python

>>> import fileinput
>>> Bcontents = open("fileB").read() #fileB contents stored as string
>>> for lines in fileinput.FileInput("fileA",inplace=1): #inplace editing of fileA
... 	lines = lines.strip() #get rid of newlines
... 	if lines.startswith("xxxx"):
... 		lines = Bcontents
... 	print lines

In fileA:

bor bor bor
something something
something
bib bib bi

thanks you

str=xxxx
sed -e "/$str/r FileB" -e "/$str/d" FileA

you're the best, thank you very much