Trailing white space:
[ \t]+$
Leading white space:
^[ \t]+
Both leading and trailing:
^[ \t]+|[ \t]+$
Also use the following if you want to trim line breaks too:
[ \t\r\n]

Technical notes, and other ideas.
Trailing white space:
[ \t]+$
Leading white space:
^[ \t]+
Both leading and trailing:
^[ \t]+|[ \t]+$
Also use the following if you want to trim line breaks too:
[ \t\r\n]