|
is a special character in regex syntax called alternation, it means "or".
Your regex is selecting the empty string at the beginning of your string.
Try escaping it:
select regexp_replace('asdf|asdf','\|','.');
As @pozs underlined, for this particular task it is way more suited to use a simple replace
:
select replace('asdf|asdf','|','.');