1 Reply Latest reply on Apr 11, 2018 2:58 PM by Patrick Van Der Hyde


    Kürşat YALIN

      Hello, everyone

      Assumed that I have a field named [country].

      I want to replace with all "a" with "b" and all "c" with "d" in the country field.

      I know that I can do it with nested replace() functions. But, How can I do with regexp_replace function?

      Thanks in advance.

        • 1. Re: REGEXP_REPLACE
          Patrick Van Der Hyde

          Hello Kursat,


          I only know a way to do this by creating two calculated fields.  One for the a to b and the next for the c to d.  The one for c to d would use the a to b field as the source data field.


          The regex is REGEXP_REPLACE([State],'a','b')

          and then  REGEXP_REPLACE([a to b],'c','d')  to get the final output.


          If you want to include the case of the letters to include Caps, then you can do this:  REGEXP_REPLACE([a to b],'(?i)c','d')  -  The modifier (?i) forces a case insensitive search.


          I hope that helps


          This example workbook is done in Tableau 10.5.3. 



          1 of 1 people found this helpful