Stack Overflow Q12435954
http://stackoverflow.com/questions/12435954/difference-in-laziness-of-lookahead-assertions-between-javascript-and-php
by acheong87
HTML
<pre id="output"></pre>
JavaScript
$('#output').append('foobar'.replace(/(?=(bar))/, '$1') + "\n");
$('#output').append('foobar'.replace(/(?=(bar))?/, '$1') + "\n");
$('#output').append('foobar'.replace(/(?:(?=(bar)))?/, '$1') + "\n");