fixed a bug of trim module when javascript is a regular expression.