title: Extracting Latitude and Longitude from different formats in text
body: <p>I've been pretty much able to do what I want in PHP, but this one is throwing me for a loop as to how to best approach it. I'm using PHP and curl.  I can get the information I want, but having trouble with sorting it.</p>
  <p>I get Hydrolant messages from <a href="https://msi.nga.mil/api/publications/download?type=view&amp;key=16694640/SFH00000/DailyMemLAN.txt" rel="nofollow noreferrer">https://msi.nga.mil/api/publications/download?type=view&amp;key=16694640/SFH00000/DailyMemLAN.txt</a> and want to extract out the bulletins I want.  I have been able to filter based on the DNC area however, I'd like to bring that further to only see reports that are greater than 55 degrees longitude and less than 165 degrees longitude.</p>
  <p>The problem is those coordinates appear in different locations within the lines of text.  The link for the Atlantic is:  <a href="https://msi.nga.mil/api/publications/download?type=view&amp;key=16694640/SFH00000/DailyMemLAN.txt" rel="nofollow noreferrer">https://msi.nga.mil/api/publications/download?type=view&amp;key=16694640/SFH00000/DailyMemLAN.txt</a>.</p>
  <p>I get the text and then go through one by one with the desire action of:</p>
  <pre><code> 1.  Is it in the DNC area that is wanted (done).
   2.  Is it for an area &gt; 55 degrees longitude and &lt; 165 degrees latitude.
   3.  Save the message that meets the criteria.
  </code></pre>
  <p>The different variations of how the lat / lon is embedded in the text is throwing me for a loop.  I need to get to what the longitude of the bulletin is (do not need minutes or seconds, degrees is sufficient) and does it fit within my area of interest.</p>
  <p>Semi-Solved:</p>
  <p>I Looked for N, W and hyphen in the line.  Then used</p>
  <p>$l = preg_replace(&quot;/[^0-9NWSE-\ ]/&quot;, &quot;&quot;, trim($l));</p>
  <p>Turned the remaining into an array and stepped through each word looking for hyphen and either N or W.  Extracted the latitude or longitude value and then compared if within the range desired.</p>
  <p>Maybe not the best, but works.</p>