alert(document.getElementById('text').innerHTML.toLowerCase().replace(/\s*?(\S+)\s*?/, '$1'));
alert(document.getElementById('text').innerHTML.replace(/\s*?(\S+)\s*?/i, '$1'));