Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

scoped-regex

sindresorhus4.5mMIT3.0.0TypeScript support: included

Regular expression for matching scoped npm package names

scoped, npm, package, name, regex, regexp, regular, expression

readme

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.

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