npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@archoleat/reglib

v1.9.3

Published

Library with ready-to-use regex

Downloads

260

Readme

Regex Library

NPM Version NPM Downloads Specs Commitlint Editorconfig Prettier ESLint Remark

Table of Contents

This library provides a collection of useful regular expressions for various use cases.

Installation

bun i -D @archoleat/reglib

List of Regex

  • ATTRIBUTE_REGEX

    • Pattern: \[[^\]]+\].
    • Description: Matches an attribute in square brackets.
    • Example: Matches [attr], [data-test], but not [attr or attr].
  • CLASS_REGEX

    • Pattern: \.[a-z0-9_-]+.
    • Description: Matches a CSS class name starting with a dot (.).
    • Example: Matches .class, .my-class, .class_name, but not class or .class!.
  • BLOCK_REGEX

    • Pattern: [a-z][a-z0-9]*(-[a-z0-9]+)*.
    • Description: Matches a BEM block name.
    • Example: Matches block, my-block, block-name, but not Block or block!.
  • ELEMENT_REGEX

    • Pattern: (__[a-z0-9]+(-[a-z0-9]+)*).
    • Description: Matches a BEM element name.
    • Example: Matches __element, __my-element, but not element or __element!.
  • MODIFIER_REGEX

    • Pattern: (--[a-z0-9]+(-[a-z0-9]+)*).
    • Description: Matches a BEM modifier name.
    • Example: Matches --modifier, --my-modifier, but not modifier or --modifier!.
  • SIBLING_REGEX

    • Pattern: (?:[^ ,{}]+\s*)?\+\s*[^ ,{}]+.
    • Description: Matches a sibling selector in CSS.
    • Example: Matches + p, div + p, .class + .another-class, but not div > p.
  • CHILD_REGEX

    • Pattern: (?:[^ ,{}]+\s*)?>\s*[^ ,{}]+.
    • Description: Matches a child selector in CSS.
    • Example: Matches > p, div > p, .class > .another-class, but not div + p.
  • ATTRIBUTE_SIBLING_REGEX

    • Pattern: \[[^\]]+\]\s*\+\s*[^ ,{}]+.
    • Description: Matches an attribute selector followed by a sibling selector.
    • Example: Matches [attr] + div, [data-test] + .class.
  • ATTRIBUTE_CHILD_REGEX

    • Pattern: \[[^\]]+\]\s*>\s*[^ ,{}]+.
    • Description: Matches an attribute selector followed by a child selector.
    • Example: Matches [attr] > div, [data-test] > .class.
  • CLASS_SIBLING_REGEX

    • Pattern: \.[a-z0-9_-]+\s*\+\s*[^ ,{}]+.
    • Description: Matches a class selector followed by a sibling selector.
    • Example: Matches .class + div, .my-class + .another-class.
  • CLASS_CHILD_REGEX

    • Pattern: \.[a-z0-9_-]+\s*>\s*[^ ,{}]+.
    • Description: Matches a class selector followed by a child selector.
    • Example: Matches .class > div, .my-class > .another-class.
  • NESTED_ATTRIBUTE_SIBLING_REGEX

    • Pattern: &\[[^\]]+\]\s*\+\s*[^ ,{}]+.

    • Description: Matches a nested attribute selector followed by a sibling selector.

    • Example: Matches &[attr] + div, &[data-test] + .class.

  • NESTED_ATTRIBUTE_CHILD_REGEX

    • Pattern: &\[[^\]]+\]\s*>\s*[^ ,{}]+.

    • Description: Matches a nested attribute selector followed by a child selector.

    • Example: Matches &[attr] > div, &[data-test] > .class.

  • NESTED_CLASS_SIBLING_REGEX

    • Pattern: &\.[a-z0-9_-]+\s*\+\s*[^ ,{}]+.
    • Description: Matches a nested class selector followed by a sibling selector.
    • Example: Matches &.class + div, &.my-class + .another-class.
  • NESTED_CLASS_CHILD_REGEX

    • Pattern: &\.[a-z0-9_-]+\s*>\s*[^ ,{}]+.
    • Description: Matches a nested class selector followed by a child selector.
    • Example: Matches &.class > div, &.my-class > .another-class.
  • NESTED_ATTRIBUTE_REGEX

    • Pattern: &\[[^\]]+\].
    • Description: Matches a nested attribute selector.
    • Example: Matches &[attr], &[data-test].
  • NESTED_CLASS_REGEX

    • Pattern: &\.[a-z0-9_-]+.
    • Description: Matches a nested class selector.
    • Example: Matches &.class, &.my-class.
  • FONT_FILE_NAME_REGEX

    • Pattern: A complex regex for matching font file names.

    • Description: Matches font file names based on family, weight, italic, variable, and extension.

    • Example: Matches Roboto-Bold.woff2, OpenSans-Italic-Variable.ttf.

      More info validate-font-file-name

Contributing

Please read CONTRIBUTING to start contributing.

License

This project is licensed under the MIT license.