Search code examples
javascripthl7mirth

Replace question mark within a word


I am getting HL7 messages through with question marks charcters in the middle of words like "can?t and dc?d" and I want to replace them with apostrophe. I was able to replace character (?) at the beginning of the sentence using mystring.replace(/^\?/,"-") I tried mystring.replace(/['\x3f']/g,"'"); but the problem with this one is it converts all questions marks.

Thanks in Advance


Solution

  • I had to do this manually to fix the problem. mystring.replace("?t","'t") and mystring.replace("?d","'d"). This works just fine