Socket
Book a DemoInstallSign in
Socket

mapcode-regex

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mapcode-regex

Regular expression for matching mapcodes

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
137
10.48%
Maintainers
1
Weekly downloads
 
Created
Source

mapcode-regex Build Status

Regular expression for matching mapcodes

Install

$ npm install --save mapcode-regex

Usage

var 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']

It's a function so you can create multiple instances. Regexes with the global flag will have the .lastIndex property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for .test().

Tip

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

License

MIT © Sindre Sorhus

Keywords

mapcode

FAQs

Package last updated on 19 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts