title: Validate gps coordinates lat and long
body: <p>I have two regexes took from here: <a href="https://stackoverflow.com/a/26119160/2829150">https://stackoverflow.com/a/26119160/2829150</a>
  It should correctly validate both latitude and longitude. Nevertheless something is wrong, and for valid coordinates it gives me false.</p>
  <p>Example (valid) coordinates which is till got as it is not valid according to methods regex.</p>
  <pre><code>Lat: 53.0102721
  Lon: 18.6048094
  </code></pre>
  <p>Code:</p>
  <pre><code>public static bool IsValidLatitude(string latitude)
  {
        var reg = new Regex(@&quot;^(\+|-)?((\d((\.)|\.\d{1,6})?)|(0*?[0-8]\d((\.)|\.\d{1,6})?)|(0*?90((\.)|\.0{1,6})?))$&quot;);
        return reg.IsMatch(latitude);
  }
  
  public static bool IsValidLongitude(string longtitude)
  {
        var reg = new Regex(@&quot;^(\+|-)?((\d((\.)|\.\d{1,6})?)|(0*?\d\d((\.)|\.\d{1,6})?)|(0*?1[0-7]\d((\.)|\.\d{1,6})?)|(0*?180((\.)|\.0{1,6})?))$&quot;);
        return reg.IsMatch(longtitude);
  }
  </code></pre>
  <p><strong>Note that:</strong> it don't need to be regex. It can be whatever else keeping in mind to check whether dot (.) was used no matter to what pc settings for separator is set up. I am open on any other proposition.</p>