$product = "MOTOROLAx|xx|xx|x01-01-1900x|xYx|x"; $product =~ s/x\|xx\|x/x\|x x\|x/g; print "[ $product ]\n"; __END__ [ MOTOROLAx|x x|xx|x01-01-1900x|xYx|x ]