We normally see people complaining about the unknown option to s' error in sed when they want to use a pattern that contains the sed delimiter.

For example, if we are using / :

$ var="hel/lo" $ sed "s/a/$var/g" <<< "haha" sed: -e expression #1, char 9: unknown option to `s'

So we advise to use another delimiter, for example | :

$ sed "s|a|$var|g" <<< "haha" hhel/lohhel/lo

However, I want to know what are the possible delimiters sed can accept... since it seems to be almost any character including regex-like ones ( * , ? , . , ...)!

In my sed (GNU sed) 4.2.2 :

$ sed 's/a/b/g' <<< "haha" hbhb $ sed 's_a_b_g' <<< "haha" hbhb $ sed 's#a#b#g' <<< "haha" hbhb $ sed 's$a$b$g' <<< "haha" hbhb $ sed 's?a?b?g' <<< "haha" hbhb $ sed 's*a*b*g' <<< "haha" hbhb $ sed 's-a-b-g' <<< "haha" hbhb $ sed 's.a.b.g' <<< "haha" hbhb $ sed 'sXaXbXg' <<< "haha" hbhb $ sed 'sxaxbxg' <<< "haha" hbhb $ sed 's1a1b1g' <<< "haha" hbhb

Even a works here if it is escaped:

$ sed 'saaabag' <<< "haha" sed: -e expression #1, char 5: unknown option to `s' $ sed 'sa\aabag' <<< "haha" hbhb

Is there any specification for this?