title: Chrome extension content script match pattern exclude subpaths
body: <p>I will try to make this as short as possible. I have this Chrome extension that I want to run on a specific website (path more specifically) and that path ONLY. My <code>manifest.json</code> looks like this:</p>
  <pre class="lang-json prettyprint-override"><code>{
      &quot;manifest_version&quot;: 3,
      &quot;name&quot;: &quot;ProjectName&quot;,
      &quot;version&quot;: &quot;0.0.1&quot;,
  
      &quot;description&quot;: &quot;Gets games.&quot;,
  
      &quot;permissions&quot;: [
          &quot;tabs&quot;,
          &quot;storage&quot;,
          &quot;cookies&quot;
      ],
      &quot;host_permissions&quot;: [
          &quot;*://*.mywebsite.com/*&quot;
      ],
      &quot;content_scripts&quot;: [
          {
              &quot;matches&quot;: [&quot;*://*.mywebsite.com/discover&quot;],
              &quot;run_at&quot;: &quot;document_end&quot;,
              &quot;js&quot;: [&quot;discovery.js&quot;]
          },
          {
              &quot;matches&quot;: [&quot;*://*.mywebsite.com/home&quot;],
              &quot;run_at&quot;: &quot;document_end&quot;,
              &quot;js&quot;: [&quot;home.js&quot;],
              &quot;css&quot;: [&quot;new.css&quot;]
          }
      ],
      &quot;background&quot;: {
          &quot;service_worker&quot;: &quot;background.js&quot;
      },
      &quot;incognito&quot;: &quot;split&quot;,
      &quot;short_name&quot;: &quot;ProjectName&quot;
  }
  </code></pre>
  <p>Now, as you can see from the first content script, I want it to run on <code>mywebsite.com/discover</code>. Although this works, there is one issue, it runs on ALL paths that have the discover path. For instance, the url <code>mywebsite.com/discover#/sortName/defaultSort</code> would also run the code. I simply do not want that.</p>
  <p>I tried changing it to <code>mywebsite.com/discover/</code> and <code>mywebsite.com/discover#/</code>, but when I do that, the content script never runs. If anyone knows how to make it run on <code>mywebsite.com/discover</code> but not any other path, please let me know. Thank you for your time and help, I greatly appreciate it.</p>