Skip to content

parse dms with spaces between input #9

@aliencraft1512

Description

@aliencraft1512

Hi. In my occasion i needed spaces between the dms coordinates like this 51 30 0.54, -0 7 34.45.
So for anyone interested you just have to change the main regex to this in order to get the results.

FROM THIS
var dmsRe = /([NSEW])?(-)?(\d+(?:.\d+)?)[°º:d\s]?\s?(?:(\d+(?:.\d+)?)['’‘′:]\s?(?:(\d{1,2}(?:.\d+)?)(?:"|″|’’|'')?)?)?\s?([NSEW])?/i;

TO THIS
var dmsRe = /([NSEW])?(-)?(\d+(?:.\d+)?)[°º:d\s]?\s?(?:(\d+(?:.\d+)?)[^’‘′]\s?(?:(\d{1,2}(?:.\d+)?)(?:"|″|’’|''|^|)?)?)?\s?([NSEW])?/i;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions