old browser compatibility

While recently using your library in a project with browserify, the `.trim()` method prevented it from working in IE7.
I replaced it with a regex.