sed: -e expression #1, char NN: unknown option to `s'

This is a wiki page. Be bold and improve it!

If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.

Error:

sed: -e expression #1, char 49: unknown option to `s'

Example code producing this error:
sed "s/<[^<]*example.com[^>]*>\([^<]*\)</a>/\1/g"

Solution:
check for un-escaped forward slashes. Above, the slash in </a> is unescaped. Everything coming after the third slash is considered to be options for s, like the final 'g' is intended to be.
Either escape the slashes:

sed "s/<[^<]*example.com[^>]*>\([^<]*\)<\/a>/\1/g"

Or use a different delimiter, e.g. '#':
sed "s#<[^<]*example.com[^>]*>#([^<]*\)</a>#\1/g"