Replace and replace_regex should allow empty strings as parameters
Basically, the following method call would work: $replace("abc" "a" "0")
, while this would fail:
echo $replace("abc" "a" "")
ion: expansion error: replace: two arguments are required
The same goes for replace_regex
.
I think overall the methods should allow for empty strings as parameters, but check them later and fail, if it is not an appropriate argument.
Compare this to python:
python -c 'print("abc".replace("a", ""))'
and to sed
:
echo abc | sed 's/a//g'
The same issue was raised here.
Overall, I can try to fix that later if the change makes sense.