title: regex positive negative decimal numbers, comma separated
body: <p>I am having trouble getting the regex right for the validation. Need multiple decimals, positive, negative numbers, and comma separated to be allowed and NOTHING else.</p>
  
  <p>Should allow:</p>
  
  <p>41.975481,-87.728222, 41.974141,-87.721569, 41.973247,-87.7135</p>
  
  <p>Shouldn't allow:</p>
  
  <p>41.975481,-87.728222, 41.97TEST4141,-87.721569, 41.973247,-87.7135, test </p>
  
  <p>This is what I am using but its allowing for characters. </p>
  
  <pre><code>(\-?\d+(\.\d+))(,\s*(\-?\d+(\.\d+)))*
  </code></pre>
  
  <p>Am I missing something?</p>
  
  <pre><code>$('textarea[name="latlong"]').bind('focusout',function(){
          $(".polygon .geoerror").text("");
          var polygon = $(this).val();
          //remove trailing comma and extra space if its there
          polygon = polygon.replace(/,\s*$/, "");
          var checkpoly = /(\-?\d+(\.\d+))(,\s*(\-?\d+(\.\d+)))*/;
          var evenodd = polygon.split(',').length;
  
          if (checkpoly.test(polygon) &amp;&amp; evenodd % 2 == 0) {
              $(".polygon .geoerror").text("Polygon string is valid." + polygon);
              $(".polygon .geoerror").css("color", "green");
          } else if (checkpoly.test(polygon) &amp;&amp; evenodd % 2) {
              $(".polygon .geoerror").text("Mismatch of lat and long values." + polygon);
              $(".polygon .geoerror").css("color", "red");
          } else {
              $(".polygon .geoerror").text("Not valid." + polygon);
              $(".polygon .geoerror").css("color", "red");
          }
          return false;
      });
  </code></pre>
  
  <p>Based on the code if the user inputs - 41.975481,-87.728222, 41.974141,-87.721569, 41.973247,-87.7135, test - then it tests as valid. It needs to error instead.</p>