veaz

RegExp reqeust for DEG and DMS coordinates

Sep 22nd, 2011
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. Searching regexp to get out DEG and DMS coordinates of a string.
  2.  
  3. So i want:
  4. One regular expression, which searches for DEG or DMS and gives me the coordinates. The string has weather DEG or DMS, never both.
  5.  
  6. Strings can look like this:
  7. DEG: "...BREITE\n48.9358\nLAENGE\n15.0300\nMETER von..."
  8. or
  9. DMS: "...BREITE\n45 20'20N\nLAENGE\n12 20'20E\nMETER von..."
  10.  
  11. Current use RegExp to get out DEG is "/[+-]?\d+\.\d+/".
  12.  
  13. Result shall be like (php):
  14. DEG: array([0] => "48.9358", [1] => "15.0300")
  15. DMS: array([0] => "45 20'20N", [1] => "12 20'20E")
Advertisement
Add Comment
Please, Sign In to add comment