Q:

Regex code tested but not matching when used with sed

Why does the following
$ echo "test\|String" | sed 's/(?!\||\\)./&./g'
test\|String

Not produce:
t.e.s.t.\|S.t.r.i.n.g.

I have tested the regex code and it picks the string up correctly in my tests
I want it to do the following:
$ echo "test\|String" | sed 's/(?!\||\\)./&./g'
t.e.s.t.\|S.t.r.i.n.g.

A:

I would have written what you describe like this:
echo "test\|String" | sed 's/[^\\|]/&./g'

