1 Reply Latest reply on Aug 16, 2018 9:26 AM by meenu choudhary

    Understanding behaviour of REGEXP_REPLACE vs REGEXP_EXTRACT

    Konrad Zdeb

      Given the data available in OrigName column I'm interested in arriving at CleanName values.

      OrigNameCleanName
      Glasgow111GLASGOW
      Place78967856PLACE
      86786somePlaceSOMEPLACE
      667%NoPlaceNOPLACE
      8778967London7LONDON
      54564New%20YorkNEWYORK

       

       

      This is currently achieved with syntax:

      UPPER(REGEXP_REPLACE([OrigName], '[^a-zA-Z]', ''))
      

       

      My desired syntax would correspond to:

      UPPER(REGEXP_EXTRACT([OrigName], '[a-zA-Z]'))
      

      However, this returns NULL.

       

      I would like to know why regex [a-zA-Z] is syntactically correct for defining set of letters to extract.egexa-zA-Z]