 <p>You don't need to use Regex, you can just use .length to search for the longest string.</p> <p>i.e.</p> <pre><code>function longestWord(string) { var str = string.replace(/[\.,-\/#!$%\^&amp;\*;:{}=\-_`~()]/g,"").split(" "); longest = str[0].length; longestWord = str[0]; for (var i = 1; i &lt; str.length; i++) { if (longest &lt; str[i].length) { longest = str[i].length; longestWord= str[i]; } } return longestWord; } </code></pre> <p>EDIT: You do have to use some Regex...</p>