sed allows several syntax delimiters,
/ being only the one most commonly used.
You can just as well say
sed -i 's,<string>,<some/directory>,g' file.txt
, now has the function usually performed by the
/, thereby freeing the latter from its special meaning.
Note, however (as pointed out by @Jeff Schaller), that now the
, must not appear in the file or directory name - and it is a valid character for filenames! This answer gives a good overview on how to proceed when applying
sed to a string with special characters.