Add check to ensure trim does not error

- checks that input exists before attempting regex
- silences a thrown error
	- seems to keep with spirit of template filters, if value is not provided no need to throw an error