title: Regex timeouts when to many -
body: <p>This is way above my level of regex knowledge. I haven't worked that much with regex before but this is the first time i have encountered that a regex timeouts. </p>
  
  <p>What I'm trying to do is to find the matching word + 3 words before and 3 after in Instagram posts. As you know some Instagram posts just is too weird.</p>
  
  <p>This is the (truncated) Instagram post:</p>
  
  <pre class="lang-none prettyprint-override"><code> ⏬⏬
  WA ☎ :  --------------------------------------------------------------------
  ---------------------
  
  ----------------------------------------------------------------------------
  -------------
    
  ------------------------------------------------------------
  #paytrenustyusufmansur
  #bisnisberkah
  #fintech
  #MUI
  #bisnissyariah
  #PokokNyaPAYTRENinAJA
  #PaytrenAcademy
  </code></pre>
  
  <p>and this is my regex: </p>
  
  <pre class="lang-regex prettyprint-override"><code>\s*([a-zA-Z0-9åäöÅÄÖ_\-]+\W+){0,3}(\bPokokNyaPAYTRENinAJA(?![^.,!?\s]))(\W+[a-zA-Z0-9åäöÅÄÖ_\-]+){0,3}\s*
  </code></pre>
  
  <p>Here I'm trying to match the word <code>"PokokNyaPAYTRENinAJA"</code> and that works fine if i remove all the <code>"-"</code> characters, but somehow the regex can't handle all that <code>"-"</code> and it times out. </p>