In second case, escape character '\' is interpreted by your shell.
Use the echo command to understand the difference:
>> echo "/ChannelSetting=/{:loop /\\/{s/\\//g;N;bloop};s/(ChannelSetting=).*/\1/}"
/ChannelSetting=/{:loop /\/{s/\//g;N;bloop};s/(ChannelSetting=).*/\1/}
Note that '\' appear only once at each occurrence: missing ones have been interpreted by your shell as an escape character. So sed command does only receive the second '\' of each occurence.
>> echo '/ChannelSetting=/{:loop /\\/{s/\\//g;N;bloop};s/(ChannelSetting=).*/\1/}'
/ChannelSetting=/{:loop /\\/{s/\\//g;N;bloop};s/(ChannelSetting=).*/\1/}
As you can see, in second case, all character are sent as is to sed.
Usually you need to mix both type of string delimiter:
- ' (for special character as'\')
- " (in order to interpret some shell variables):
Example:
myMatch='ChannelSetting='
sed -i -E "/$myMatch/"'{:loop /\\/{s/\\//g;N;bloop};s/('$myMatch').*/\1/}'