Regular expression with Spark sql

 if you have data where you want to filter out all special characters along with numeric character from string then use spark sql regular expression function  - regexp_replace


Example : -

      Name

      sbdgd&(&**,4343

      ram7534- 5%7777


Select  regexp_replace(name, '[^a-zA-z]', ' ') as name from table_name


Result:

  Name

  sbdgd

  ram

Comments

Popular posts from this blog

Date format issue with spark sql

Hive Partition sub folders HIVE_UNION_SUBDIR_1,HIVE_UNION_SUBDIR_2,HIVE_UNION_SUBDIR_8

Dataiku and Dremio date difference