You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Andrés Ivaldi <ia...@gmail.com> on 2016/08/09 16:18:19 UTC
Spark 1.6.1 and regexp_replace
I'm having a strange behaviour with regular expression replace, I'm trying
to remove the spaces with trim and also remove the spaces when they are
more than one to only one.
Given a string like this " A B " with trim only I got "A B" so
perfect,
if I add regexp_replace I got " A B".
Text1 is the column so I did
df.withColumn("Text1", expr ( "trim(regexp_replace(Text1,'\\s+',' ') )) )
Also tried another expressions with no luck either
Any idea?
thanks