PurgeCSSPurgeCSS
API Reference
  • English
  • Français
GitHub
API Reference
  • English
  • Français
GitHub
  • PurgeCSS

    • About PurgeCSS
    • Getting Started
    • Configuration
    • Command Line Interface
    • Programmatic API
    • Safelisting
    • Extractors
  • Plugins

    • PostCSS
    • Webpack
    • Rollup
    • Gulp
    • Grunt
    • Gatsby
  • Guides

    • Vue
    • React
    • Angular
    • Next.js
    • Nuxt.js
    • Razzle
    • WordPress
    • Hugo
  • Comparison
  • Common Questions

    • How to use with CSS modules
    • How to use with Ant Design

Home > purgecss > matchesPattern

matchesPattern() function

Check if a value matches a pattern of the options: a regular expression, or a string written between slashes like "/^btn-/", is tested against the value, any other string matches the value exactly

Signature:

export declare function matchesPattern(pattern: string | RegExp, value: string): boolean;

Parameters

Parameter

Type

Description

pattern

string | RegExp

string or regular expression

value

string

value to match, e.g. a selector or a variable name

Returns:

boolean