scoped-regex
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

scoped-regex

Regular expression for matching scoped npm package names

Install

$ npm install scoped-regex

Usage

import scopedRegex from '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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.0.0
    16,914
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 3.0.0
    16,914
  • 2.1.0
    614,714
  • 2.0.0
    1
  • 1.0.0
    248,307

Package Sidebar

Install

npm i scoped-regex

Weekly Downloads

879,936

Version

3.0.0

License

MIT

Unpacked Size

3.52 kB

Total Files

5

Last publish

Collaborators

  • sindresorhus