The correct expression to remove white spaces using regular expression is
[\t ]+ — Make sure you select Regular Expression in Search Criteria
I used the following which id not quite work [\t ]*. The problem with this one is it match 0 or more. So it basically matche every single character rather than matches spaces only. Hope this helps somebody.
It is also a good practice, instead of complete removing white spaces, replace it by a single space as your code might not work if you remove all spaces. The search critera also remove tab characters.
^[\t ]+ = Will match white spaces that are in the beginning of each line
[\t ]+$ = will match white spaces that are at the end of each line