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
