title: Javascript/RegExp: Lookbehind Assertion is causing a "Invalid group" error
body: <p>I'm doing a simple Lookbehind Assertion to get a segment of the URL (example below) but instead of getting the match I get the following error:</p>
  
  <pre><code>Uncaught SyntaxError: Invalid regular expression: /(?&lt;=\#\!\/)([^\/]+)/: Invalid group
  </code></pre>
  
  <p>Here is the script I'm running:</p>
  
  <pre><code>var url = window.location.toString();
  </code></pre>
  
  <p><code>url ==</code> <a href="http://my.domain.com/index.php/#!/write-stuff/something-else">http://my.domain.com/index.php/#!/write-stuff/something-else</a></p>
  
  <pre><code>// lookbehind to only match the segment after the hash-bang.
  
  var regex = /(?&lt;=\#\!\/)([^\/]+)/i; 
  console.log('test this url: ', url, 'we found this match: ', url.match( regex ) );
  </code></pre>
  
  <p>the result should be <code>write-stuff</code>.</p>
  
  <p>Can anyone shed some light on why this regex group is causing this error? Looks like a valid RegEx to me.</p>
  
  <p>I know of alternatives on how to get the segment I need, so this is really just about helping me understand what's going on here rather than getting an alternative solution.</p>
  
  <p>Thanks for reading.</p>
  
  <p>J.</p>