title: Javascript regex to validate GPS coordinates
body: <p>I have a form where a user inserts the GPS coordinates of a location to a corresponding photo.  Its easy enough to filter out invalid numbers, since I just have to test for a range of (-90, 90), (-180, 180) for lat/long coordinates.</p>
  
  <p>However, this also means that regular text is valid input.</p>
  
  <p>I've tried changing the test pattern to</p>
  
  <pre><code>var pattern= "^[a-zA-Z]" 
  </code></pre>
  
  <p>and is used in the function to detect alphabetical characters</p>
  
  <pre><code>$(".lat").keyup(function(){
    var thisID= this.id;
    var num = thisID.substring(3, thisID.length);
    var thisVal = $(this).val();
  
    //if invalid input, show error message and hide save button
    if (pattern.test(thisVal)){
      $("#latError"+num).fadeIn(250);
      $("#save"+num).fadeOut(100)
    } 
    else { //otherwise, hide error message and show save
      $("#save"+num).fadeIn(250);
      $("#latError"+num).fadeOut(100);
    }
  });
  </code></pre>
  
  <p>However, this doesn't work as Firebug complains that <code>pattern.test</code> is not a function  What would solve this issue?</p>