<p dir="auto">Using this regular expressions to test json breaks syntax highlighting for the last regex on the line and if it's part of an if statement it breaks syntax highlighting for the rest of the file.</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/^[\],:{}\s]*$/.test( text.replace( /\\[&quot;\\\/bfnrtu]/g, '@' ).replace( /&quot;[^&quot;\\\n\r]*&quot;|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']' ).replace( /(?:^|:|,)(?:\s*\[)+/g , ''))"><pre class="notranslate"><span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">^</span><span class="pl-kos">[</span><span class="pl-cce">\]</span>,:{}<span class="pl-cce">\s</span><span class="pl-kos">]</span><span class="pl-c1">*</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span> <span class="pl-s1">text</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\\</span><span class="pl-kos">[</span>"<span class="pl-cce">\\</span><span class="pl-cce">\/</span>bfnrtu<span class="pl-kos">]</span><span class="pl-c1">/</span>g</span><span class="pl-kos">,</span> <span class="pl-s">'@'</span> <span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span>"<span class="pl-kos">[</span>^"<span class="pl-cce">\\</span><span class="pl-cce">\n</span><span class="pl-cce">\r</span><span class="pl-kos">]</span><span class="pl-c1">*</span>"<span class="pl-c1">|</span>true<span class="pl-c1">|</span>false<span class="pl-c1">|</span>null<span class="pl-c1">|</span>-?<span class="pl-cce">\d</span><span class="pl-c1">+</span><span class="pl-kos">(?:</span><span class="pl-cce">\.</span><span class="pl-cce">\d</span><span class="pl-c1">*</span><span class="pl-kos">)</span>?<span class="pl-kos">(?:</span><span class="pl-kos">[</span>eE<span class="pl-kos">]</span><span class="pl-kos">[</span>+<span class="pl-cce">\-</span><span class="pl-kos">]</span>?<span class="pl-cce">\d</span><span class="pl-c1">+</span><span class="pl-kos">)</span>?<span class="pl-c1">/</span>g</span><span class="pl-kos">,</span> <span class="pl-s">']'</span> <span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-kos">(?:</span><span class="pl-cce">^</span><span class="pl-c1">|</span>:<span class="pl-c1">|</span>,<span class="pl-kos">)</span><span class="pl-kos">(?:</span><span class="pl-cce">\s</span><span class="pl-c1">*</span><span class="pl-cce">\[</span><span class="pl-kos">)</span><span class="pl-c1">+</span><span class="pl-c1">/</span>g</span> <span class="pl-kos">,</span> <span class="pl-s">''</span><span class="pl-kos">)</span><span class="pl-kos">)</span></pre></div>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="if ( /^[\],:{}\s]*$/.test( text.replace( /\\[&quot;\\\/bfnrtu]/g, '@' ).replace( /&quot;[^&quot;\\\n\r]*&quot;|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']' ).replace( /(?:^|:|,)(?:\s*\[)+/g , ''))){
      // do sth
  }else{
      // do someotherthing
  }"><pre class="notranslate"><span class="pl-k">if</span> <span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">^</span><span class="pl-kos">[</span><span class="pl-cce">\]</span>,:{}<span class="pl-cce">\s</span><span class="pl-kos">]</span><span class="pl-c1">*</span><span class="pl-cce">$</span><span class="pl-c1">/</span></span><span class="pl-kos">.</span><span class="pl-en">test</span><span class="pl-kos">(</span> <span class="pl-s1">text</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-cce">\\</span><span class="pl-kos">[</span>"<span class="pl-cce">\\</span><span class="pl-cce">\/</span>bfnrtu<span class="pl-kos">]</span><span class="pl-c1">/</span>g</span><span class="pl-kos">,</span> <span class="pl-s">'@'</span> <span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span>"<span class="pl-kos">[</span>^"<span class="pl-cce">\\</span><span class="pl-cce">\n</span><span class="pl-cce">\r</span><span class="pl-kos">]</span><span class="pl-c1">*</span>"<span class="pl-c1">|</span>true<span class="pl-c1">|</span>false<span class="pl-c1">|</span>null<span class="pl-c1">|</span>-?<span class="pl-cce">\d</span><span class="pl-c1">+</span><span class="pl-kos">(?:</span><span class="pl-cce">\.</span><span class="pl-cce">\d</span><span class="pl-c1">*</span><span class="pl-kos">)</span>?<span class="pl-kos">(?:</span><span class="pl-kos">[</span>eE<span class="pl-kos">]</span><span class="pl-kos">[</span>+<span class="pl-cce">\-</span><span class="pl-kos">]</span>?<span class="pl-cce">\d</span><span class="pl-c1">+</span><span class="pl-kos">)</span>?<span class="pl-c1">/</span>g</span><span class="pl-kos">,</span> <span class="pl-s">']'</span> <span class="pl-kos">)</span><span class="pl-kos">.</span><span class="pl-en">replace</span><span class="pl-kos">(</span> <span class="pl-pds"><span class="pl-c1">/</span><span class="pl-kos">(?:</span><span class="pl-cce">^</span><span class="pl-c1">|</span>:<span class="pl-c1">|</span>,<span class="pl-kos">)</span><span class="pl-kos">(?:</span><span class="pl-cce">\s</span><span class="pl-c1">*</span><span class="pl-cce">\[</span><span class="pl-kos">)</span><span class="pl-c1">+</span><span class="pl-c1">/</span>g</span> <span class="pl-kos">,</span> <span class="pl-s">''</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">)</span><span class="pl-kos">{</span>
      <span class="pl-c">// do sth</span>
  <span class="pl-kos">}</span><span class="pl-k">else</span><span class="pl-kos">{</span>
      <span class="pl-c">// do someotherthing</span>
  <span class="pl-kos">}</span></pre></div>
<p dir="auto">This seems to be some edge case since trying to simplify the regexes to narrow down the problem failed because the problem just disappeared when removing any substantial part from any regex.</p>
<p dir="auto">By the way, I also tested it in safe mode with the standard dark syntax highlighting, it happens there as well.</p>
<p dir="auto">Atom 0.112.0<br>
Arch Linux</p>
<p dir="auto">I opened a Python file with the following line (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="20976125" data-permission-text="Title is private" data-url="https://github.com/atom/atom/issues/963" data-hovercard-type="pull_request" data-hovercard-url="/atom/atom/pull/963/hovercard" href="https://github.com/atom/atom/pull/963">#963</a>):</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="                    PrintAndLog(u&quot;SSID: &quot; + RememberedNetwork[&quot;SSIDString&quot;].decode(&quot;utf-8&quot;) + u&quot; - BSSID: &quot; + RememberedNetwork[&quot;CachedScanRecord&quot;][&quot;BSSID&quot;] + u&quot; - RSSI: &quot; + str(RememberedNetwork[&quot;CachedScanRecord&quot;][&quot;RSSI&quot;]) + u&quot; - Last connected: &quot; + str(RememberedNetwork[&quot;LastConnected&quot;]) + u&quot; - Security type: &quot; +  RememberedNetwork[&quot;SecurityType&quot;] + u&quot; - Geolocation: &quot; + Geolocation, &quot;INFO&quot;)"><pre class="notranslate">                    <span class="pl-v">PrintAndLog</span>(<span class="pl-s">u"SSID: "</span> <span class="pl-c1">+</span> <span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"SSIDString"</span>].<span class="pl-en">decode</span>(<span class="pl-s">"utf-8"</span>) <span class="pl-c1">+</span> <span class="pl-s">u" - BSSID: "</span> <span class="pl-c1">+</span> <span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"CachedScanRecord"</span>][<span class="pl-s">"BSSID"</span>] <span class="pl-c1">+</span> <span class="pl-s">u" - RSSI: "</span> <span class="pl-c1">+</span> <span class="pl-en">str</span>(<span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"CachedScanRecord"</span>][<span class="pl-s">"RSSI"</span>]) <span class="pl-c1">+</span> <span class="pl-s">u" - Last connected: "</span> <span class="pl-c1">+</span> <span class="pl-en">str</span>(<span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"LastConnected"</span>]) <span class="pl-c1">+</span> <span class="pl-s">u" - Security type: "</span> <span class="pl-c1">+</span>  <span class="pl-v">RememberedNetwork</span>[<span class="pl-s">"SecurityType"</span>] <span class="pl-c1">+</span> <span class="pl-s">u" - Geolocation: "</span> <span class="pl-c1">+</span> <span class="pl-v">Geolocation</span>, <span class="pl-s">"INFO"</span>)</pre></div>
<p dir="auto">Which led to the following bug:<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://camo.githubusercontent.com/e06069206d526a16adf21e84cd179f1185d3fb5e0f05fea4d4b4a08a978092f4/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f34343737342f323331333737382f37366262346262612d613330642d313165332d396136342d3831663666393163323563342e706e67"><img src="https://camo.githubusercontent.com/e06069206d526a16adf21e84cd179f1185d3fb5e0f05fea4d4b4a08a978092f4/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f34343737342f323331333737382f37366262346262612d613330642d313165332d396136342d3831663666393163323563342e706e67" alt="screen shot 2014-03-03 at 2 52 40 pm" data-canonical-src="https://f.cloud.github.com/assets/44774/2313778/76bb4bba-a30d-11e3-9a64-81f6f91c25c4.png" style="max-width: 100%;"></a></p>
<p dir="auto">You can find this as the main file in <a href="https://github.com/jipegit/OSXAuditor/blob/master/osxauditor.py"><code class="notranslate">osxauditor.py</code></a>.</p>