简体   繁体   English

匹配WGS84坐标

[英]Match a WGS84 coordinate

I would like to match a WGS84 coordinate system from a string. 我想从字符串中匹配WGS84坐标系。

The Coordinate is written like this: 坐标是这样写的:

dddmm.sss,H

where 哪里

ddd: 0-180
mm: 0-59
sss: 0-999
H: W or E

I tried a regex from the internet, but the match didn't work sadly. 我从互联网上尝试了一个正则表达式,但比赛并没有奏效。 How would the regex for this look? 正则表达式看起来如何?

(0[0-9][0-9]|1[0-7][0-9]|180)[0-5][0-9]\\.[0-9][0-9][0-9],[EW] in POSIX ERE and PCRE. (0[0-9][0-9]|1[0-7][0-9]|180)[0-5][0-9]\\.[0-9][0-9][0-9],[EW]POSIX ERE和PCRE中。

Use (0[0-9][0-9]|1[0-7][0-9]|180)[0-5][0-9]\\.[0-9]*,[EW] if you're trying to parse NMEA 0183 as the amount of fractional digits varies between devices (a reference says 2, you have 3, and I've seen a device give four digits). 使用(0[0-9][0-9]|1[0-7][0-9]|180)[0-5][0-9]\\.[0-9]*,[EW]如果您尝试解析NMEA 0183因为设备之间的小数位数有所不同(参考数字为2,则表示您有3,而我看到设备给出了四位数)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM