2 Replies Latest reply on Nov 16, 2017 1:46 PM by Davis Blair

    Confused about Regex

    Davis Blair

      I am a new user and trying to extract a phone number from a string of data. The instructions include going to RegexPal.com and typing in an expression and then going back to Tableau and creating a calculated field:

      REGEXP_EXTRACT([String of Data], ' (\([0-9](3)\))-[0-9](3)-[0-9](4))'). Calculation is valid but I don't get the connection between the RegexPal site and the workbook - How does this extract happen? Where is the data? Any help is appreciated!


        • 1. Re: Confused about Regex



          Sounds like the idea is to find a regex expression that works on the regexTester

          and then translate it into the format that Tableau prefers.

          I think there may be some format differences between what works on the testsite

          and what works in Tableau.

          For the example of the phone number with (area code), you could try:

          a calculated field of:

          REGEXP_EXTRACT([Data String], '(\(\d+\) \d+-\d+)')


          Where the escape character \ is used to signify the open and close parentheses

          and the \d+ signifies one or more digits.

          1 of 1 people found this helpful
          • 2. Re: Confused about Regex
            Davis Blair

            Thanks Swaroop,

            Just what I needed. That and a couple lessons in regex syntax!