Popular trim Regular Expression.
Matches whitespace characters at the beginning and end of a string.
Check out the usage examples in the test string to see how you can implement it into your own code.