<p dir="auto">Challenge <a href="https://www.freecodecamp.com/challenges/check-for-palindromes#?solution=%0Afunction%20palindrome%28str%29%20%7B%0A%20%20%20%20console.log%28str%29%3B%0A%20%20str%20%3D%20str.replace%28%2F%5B%20%2C.%5D%2Fig%2C%20%22%22%29.toLowerCase%28%29%3B%0A%20%20console.log%28str%29%3B%0A%20%20for%20%28var%20i%20%3D%200%2C%20j%20%3D%20str.length%20-1%20%3B%20i%20%3C%20j%3B%20i%2B%2B%2C%20j--%29%20%7B%0A%20%20%20%20if%20%28str%5Bi%5D%20!%3D%3D%20str%5Bj%5D%29%20%7B%0A%20%20%20%20%20%20return%20false%3B%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20return%20true%3B%0A%7D%0A%0A%0A%0Apalindrome%28%22eye%22%29%3B%0A" rel="nofollow">Check for Palindromes</a> has an issue.<br>
User Agent is: <code class="notranslate">Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36</code>.<br>
Please describe how to reproduce this issue, and include links to screenshots if possible.</p>
<p dir="auto">My code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
function palindrome(str) {
    console.log(str);
  str = str.replace(/[ ,.]/ig, &quot;&quot;).toLowerCase();
  console.log(str);
  for (var i = 0, j = str.length -1 ; i &lt; j; i++, j--) {
    if (str[i] !== str[j]) {
      return false;
    }
  }
  return true;
}



palindrome(&quot;eye&quot;);
"><pre class="notranslate"><span class="pl-k">function</span> <span class="pl-en">palindrome</span><span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-s1">str</span> <span class="pl-c1">=</span> <span class="pl-s1">str</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-kos">]</span><span class="pl-c1">/</span>ig</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">toLowerCase</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">)</span><span class="pl-kos">;</span>
  <span class="pl-k">for</span> <span class="pl-kos">(</span><span class="pl-k">var</span> <span class="pl-s1">i</span> <span class="pl-c1">=</span> <span class="pl-c1">0</span><span class="pl-kos">,</span> <span class="pl-s1">j</span> <span class="pl-c1">=</span> <span class="pl-s1">str</span><span class="pl-kos">.</span><span class="pl-c1">length</span> <span class="pl-c1">-</span><span class="pl-c1">1</span> <span class="pl-kos">;</span> <span class="pl-s1">i</span> <span class="pl-c1">&lt;</span> <span class="pl-s1">j</span><span class="pl-kos">;</span> <span class="pl-s1">i</span><span class="pl-c1">++</span><span class="pl-kos">,</span> <span class="pl-s1">j</span><span class="pl-c1">--</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">str</span><span class="pl-kos">[</span><span class="pl-s1">i</span><span class="pl-kos">]</span> <span class="pl-c1">!==</span> <span class="pl-s1">str</span><span class="pl-kos">[</span><span class="pl-s1">j</span><span class="pl-kos">]</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
      <span class="pl-k">return</span> <span class="pl-c1">false</span><span class="pl-kos">;</span>
    <span class="pl-kos">}</span>
  <span class="pl-kos">}</span>
  <span class="pl-k">return</span> <span class="pl-c1">true</span><span class="pl-kos">;</span>
<span class="pl-kos">}</span>



<span class="pl-en">palindrome</span><span class="pl-kos">(</span><span class="pl-s">"eye"</span><span class="pl-kos">)</span><span class="pl-kos">;</span></pre></div>
<p dir="auto">palindrome("0_0 (: /-\ :) 0-0") --&gt; this is not a palindrome '_'  v.s. '-'  even If I replaced that the str that gets passed in as a param is not "0_0 (: /-\ :) 0-0" console.log says it's "0_0 (: /- :) 0-0"  it's missing the ""</p>
<p dir="auto">Challenge <a href="http://freecodecamp.com/challenges/waypoint-sift-through-text-with-regular-expressions" rel="nofollow">http://freecodecamp.com/challenges/waypoint-sift-through-text-with-regular-expressions</a> has an issue.</p>
<p dir="auto">This waypoint is confused as the nature of the plus sign and the global modifier in regex. To pass, a camper needs to use this (incorrect) expression: <code class="notranslate">/and+/gi</code>. It works, but it really means "find any instance of the pattern of one A and one N followed by any number of Ds."</p>
<p dir="auto">The solution should be <code class="notranslate">/and/gi</code>, but this doesn't pass.</p>
<p dir="auto">Here's the relevant bit from the instructions:</p>
<blockquote>
<p dir="auto">+ means we want to find one or more occurrences of this pattern.</p>
<p dir="auto">g means that we want to search the entire string for this pattern.</p>
</blockquote>
<p dir="auto">This is incorrect. The plus sign applies only to an individual character, so that an expression like this:</p>
<p dir="auto"><code class="notranslate">/and+/</code></p>
<p dir="auto">would select "and" or "andd" or "anddd", etc.</p>
<p dir="auto">Likewise <code class="notranslate">/a+nd/</code> would select "and" or "aand", etc., and <code class="notranslate">/a+n+d+/</code> would select "and" or even "aaaaaaaaaannnnnddddddd".</p>
<p dir="auto">It's not accurate to say that the global modifer (g) searches the entire string. (If that were the case, what part of the string would it be be limited to without the global modifier?)</p>
<p dir="auto">The default behavior is to search until the pattern is found, and then to stop and say, "I found it!". If it isn't found, then the entire strong IS searched. The global modifier simply says "don't stop when you find the first one, but keep going and find all of them," which is what the instructions seem to think the plus sign is doing.</p>