Trim spaces from start and end of string

Posted by James Jeffery on Stack Overflow See other posts from Stack Overflow or by James Jeffery
Published on 2010-06-08T19:38:52Z Indexed on 2010/06/08 19:42 UTC
Read the original article Hit count: 131

Filed under:
|

Trying to find a way to trim spaces from the start and end of the string. I was using this, but it dont seem to be working:

title = title.replace(/(^[\s]+|[\s]+$)/g, '');

Any ideas?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex