Having some difficulty in replacing some single/double quoted text with sed and was wondering what\'s the correct method for these 2 examples
to change
You'll have to use hex escapes, for example, to do those replacements.
$ echo "'foo'" | sed 's/\x27foo\x27/\x27bar\x27/' 'bar'
You could also use octal escapes: \o047 (that's a lower-case "Oh") or decimal escapes: \d39.
\o047
\d39