title: How to find the longest sequence of "broken" characters using Regex in JS?
body: <p>I'm trying to find the longest sequence of &quot;broken&quot;(different from letter, digit, space) characters in this sentence:</p>
  <p><strong>'Tempera####&amp;&amp;#^ na @#$ata 23 grad#%&amp;.'</strong></p>
  <p>I really want to do it using Regex, but I'm not that familiar with the usage of Regex in JS. This is the description of the problem: <a href="https://pastebin.com/U6Uukc4b" rel="nofollow noreferrer">https://pastebin.com/U6Uukc4b</a>
  I watched a lot of tutorials, also read bunch of articles and this is what I came up with:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>let input = [
          'Tempera####&amp;&amp;#^ na @#$ata 23 grad#%&amp;.'
  ];
  
  let print = this.print || console.log;
  let gets = this.gets || ((arr, index) =&gt; () =&gt; arr[index++])(input, 0);
  
  let message = gets();
  
  //different from letter, digit, space
  
  let counter = 1;
  let allWords = /[a-z1-9\s]/gi;
  
  for (let i = 0; i &lt; message.length; i++) {
    let current = message[i];
    // allWords.lastIndex = 0;
    let isExisting = allWords.test(current);
  
    if (current === '.') {
      break;
    }
    if (isExisting) {
      counter = 1;
  
    } else {
      counter++;
    }
  
  
  }
  
  print(counter)</code></pre>
  </div>
  </div>
  </p>
  <p>Here the answer should be 8 , because we have 8 consecutive symbols inside the word <code>&quot;Tempera####&amp;&amp;#^&quot;</code> , which are not letter, digit or space.</p>
  <p>Unfortunately this doesn't work. I'm still trying to understand where is my mistake, so I'll be very thankful if someone can &quot;show me the way&quot;.</p>