3 Replies Latest reply on May 6, 2018 6:06 PM by Adam Paruk

    Whats faster contains or regex?

    Adam Paruk

      Hello Tableau,

       

      I'm currently trying to simplify some field calculations I have and also try to make it all run faster. Here is my question:

       

      What is faster - CONTAINS() or REGEX_MATCH()?

       

      For example, I have a filter to find all incidents that reference a password and I can do it in two ways:

      IF REGEXP_MATCH([INCIDENT_NOTES], '(\bpassword\b|\bpass word\b|\bpw\b|\bpwd\b)') THEN TRUE
      ELSE FALSE
      END
      

      or

      IF
      CONTAINS(INCIDENT_NOTES,"password") OR
      CONTAINS(INCIDENT_NOTES,"pass word") OR
      CONTAINS(INCIDENT_NOTES,"pw") OR
      CONTAINS(INCIDENT_NOTES,"pwd") 
      THEN TRUE
      ELSE FALSE
      END
      

       

      Which version will execute quicker or at what complexity does one beat the other?