diff --git a/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js b/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js index 06d72a44a..e7ee7c7b9 100644 --- a/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js +++ b/Packages/ohif-viewerbase/client/lib/helpers/formatPN.js @@ -7,7 +7,15 @@ const formatPN = context => { return; } - return context.replace('^', ', '); + // Convert the first ^ to a ', '. String.replace() only affects + // the first appearance of the character. + const commaBetweenFirstAndLast = context.replace('^', ', '); + + // Replace any remaining '^' characters with spaces + const cleaned = commaBetweenFirstAndLast.replace(/\^/g, ' '); + + // Trim any extraneous whitespace + return cleaned.trim(); }; /**