scoped-regex
Regular expression for matching scoped npm package names
Last updated 6 years ago by sindresorhus .
MIT · Repository · Bugs · Original npm
$ cnpm install scoped-regex 
SYNC missed versions from official npm registry.

scoped-regex Build Status

Regular expression for matching scoped npm package names

Install

$ npm install scoped-regex

Usage

const scopedRegex = require('scoped-regex');

scopedRegex({exact: true}).test('@sindresorhus/df');
//=> true

'foo @sindresorhus/df bar'.match(scopedRegex());
//=> ['@sindresorhus/df']

API

scopedRegex([options])

Returns a RegExp for matching scoped package names.

options

Type: Object

exact

Type: boolean
Default: false (Matches any scoped package names in a string)

Only match an exact string. Useful with RegExp#test() to check if a string is a scoped package name.

Related

  • is-scoped - Check if a string is a scoped npm package name

License

MIT © Sindre Sorhus

Current Tags

  • 3.0.0                                ...           latest (4 years ago)

3 Versions

  • 3.0.0                                ...           4 years ago
  • 2.1.0                                ...           6 years ago
  • 1.0.0                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (3)
Dependents (0)
None

Copyright 2013 - present © cnpmjs.org