I do not understand the type of your problem exactly. If it is about the escaping of escape characters (backslash for example) and quotation marks, there is a simple (almost stupid) trick, saving a lot of brain twisting:
Type the string in TextEdit and run the simple AppleScript
tell application "TextEdit"
text of document 1
end tell
Copy the string from the result pane. Your entire sed string becomes