Skip to content
Regular expression for matching mapcodes
JavaScript
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.editorconfig
.gitattributes
.gitignore
.travis.yml
index.js
license
make.js
package.json
readme.md
test.js

readme.md

mapcode-regex Build Status

Regular expression for matching mapcodes

Install

$ npm install --save mapcode-regex

Usage

const mapcodeRegex = require('mapcode-regex');

mapcodeRegex().test('4J.Q2');
//=> true

mapcodeRegex().test('Hawaii ZSR.3J');
//=> true

mapcodeRegex().exec('This is a mapcode FRA 4J.Q2')[0];
//=> 'FRA 4J.Q2'

'Multiple FRA 4J.Q2 Hawaii ZSR.3J mapcodes'.match(mapcodeRegex());
//=> ['FRA 4J.Q2', 'Hawaii ZSR.3J']

Tip

You can use clone-regexp to change the flags. In this case maybe remove the global flag.

Related

  • mapcode - Find mapcodes in a string

License

MIT © Sindre Sorhus

You can’t perform that action at this time.