3 Replies Latest reply on Dec 30, 2016 7:02 AM by Norbert Maijoor

    How to edit string

    kieran keene

      Hi,

       

      I am looking to remove everything to the left of the first '.'

       

      I have a list of domains:

       

      App.Google.com

      News.Example.Com

      International.Domain.Com

       

      Each of the subdomains are different lengths.

       

      How would I do this?

       

      Thanks         

        • 1. Re: How to edit string
          Norbert Maijoor

          Hi Kieran,

           

          Find my approach as reference below and stored in attached workbook version 9.3

           

          mid([Domain],FIND([Domain],".")+1,100)

           

           

           

          • 2. Re: How to edit string
            Naledi Hollbruegge

            Hi Kieran,

             

            What Norbert suggested sounds sufficient for this situation and a good approach.

            Two other options that may be useful in these situations are:

             

            1) Using regular expressions

            This depends slightly on how your fields are formatted. For the examples you named you could use a calculated field with the following expression:

            REGEXP_EXTRACT([F1], ".*\.(.*\.[Cc]om)")

            This approach is in some ways more flexible. However, this may not match all of your fields (for instance if it is not always '.com' you would have to change the expression.)

             

            2)  Using SPLIT

            Create a custom split in a calculated field, which uses the period to split the field, then define how you want to put the parts together. In this case you want to add the second and the third part and will have to add in the period between them again.

            SPLIT( [F1], '.', 2) + '.'+ SPLIT( [F1], '.', 3)

            2 of 2 people found this helpful
            • 3. Re: How to edit string
              Norbert Maijoor

              H Naledi,

               

              Thanks for stepping in. What I like about Tableau you can start "simple" and end up "sophisticated". Thanks for that:)