Re:Mitch Hedberg and GIS
by tzs on Monday August 18, 2014 @06:40AM
(#8192082)
It's actually pretty easy and quick to write when the data is highly regular (no pun intended!). You can write this kind of expression by taking one of the lines of input:
and then making a regular expression that matches that line literally [1]:
Then replace the parts that will vary with regular expressions to capture them. We want to capture the "n" field:
and the "i" field:
and the longitude and latitudes from the "p" field:
and the "s" field:
We don't care about the "c" field, so I'm going to drop it:
If we want to be fancy, we can make sure that the latitude and longitude consist only of digits, decimal points, and minus signs:
For a one time thing like this, I'd probably deal with this data with a pipe in the shell, rather than use regular expressions:
[1] I shall use Perl regular expression
[ Parent
| on HN ]
There are no comments on this comment yet.