Trim Whitespace before/after String
Remove whitespace before and after the string.
Use g for trimming before and after
Use m for trimming each line of a multiline string individually.
Code:
' test '.replace( /(^\s+|\s+$)/gm, '' );
Submitted by KevinV - 9 years ago