Skip to content

Instantly share code, notes, and snippets.

@gatlin
Created July 29, 2012 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gatlin/3201811 to your computer and use it in GitHub Desktop.
Save gatlin/3201811 to your computer and use it in GitHub Desktop.
Simple regex for DMS angle notation
#!/usr/bin/env perl
use v5.16;
use strict;
use warnings;
while (my $str = <STDIN>) {
say "DMS" if $str =~
m/([0-9]+(\W*)deg((ree)?s?)?)?(\W*)([0-9]+(\W*)min((ute)?s?)?)?(\W*)([0-9]+(\.[0-9]*)?(\W*)sec((ond)?s?)?)?/;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment