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 🙏

© 2026 – Pkg Stats / Ryan Hefner

srl-lang

v1.1.1

Published

Structured RegExp Language | Helps you write regular expressions more easily

Downloads

1

Readme

SRL - Structured RegExp Language

This is a simple language which compiles into a "Regular Expression". The language is inspired by the post of u/johnngnky on Reddit.

I don't follow the post from him but the way I created the syntax is inspired by his post and I got the idea to make this from him.

The project is in an very early state and is not mend to be used in an actual application.

Language

Data Types

SRL has a few data types you should know before starting to work with SRL.

| Name | Usage | Description | | -------- | ------ | ---------------------------------- | | Number | $5 | A number is idecated by a $ | | String | "Foo" | A string is contained inside two " | | Constant | !digit | A constant is indecated by a ! |

Constants

Constants are pre defined patterns that can be reused.

| Name | Usage | RegExp | Description | | ------------------------------ | ------------- | ------ | ----------------------------------------- | | Any char | !any | . | Any single character | | Any whitespace | !whitespace | \s | Any whitespace character | | Any non-whitespace | !!whitespace | \S | Any non-whitespace character | | Any digit | !digit | \d | Any digit | | Any non-digit | !!digit | \D | Any non-digit | | Any word character | !word | \w | Any word character | | Any non-word character | !!word | \W | Any non-word character | | Any unicode sequence | !unicode | \X | Any Unicode sequence, linebreaks included | | Match data unit | !dataunit | \C | Match one data unit | | Unicode newline | !uninl | \R | Unicode newlines | | Anything but newline | !!newline | \N | Match anything but a newline | | Vertical whitespace | !vwhitespace | \v | Vertical whitespace character | | Negative vertical whitespace | !!vwhitespace | \V | Negation of \v | | Horizontal whitespace | !hwhitespace | \h | Horizontal whitespace character | | Negative horizontal whitespace | !!hwhitespace | \H | Negation of \h | | Reset Match | !reset | \K | Reset match | | Control character Y | !ycontrol | \cY | Control Character Y | | Backspace | !backspace | [\b] | Backspace character | | Newline | !newline | \n | Newline | | Carriage return | !carriage | \r | Carriage return | | Tab | !tab | \t | Tab | | Null character | !null | \0 | Null charachter |

Anchors

Anchors allows you to jump to certain points.

| Name | Usage | RegExp | Descriptions | | ------------------ | ------------------ | ------ | --------------------- | | Start match | STAT MATCH | \G | Start of match | | Start input* | START INPUT | ^ / \A | Start of input | | End input* | END INPUT | $ / \Z | End of input | | Absolute end input | ABSOLUTE END INPUT | \z | Absolute end of input | | word boundary | WORD BOUNDARY | \b | A word boundary | | boundary | BOUNDARY | \B | Non-word boundary |

* ^ and $ match the start and end of a line if Multiline is enabled

Groups

Groups are much like normal groups in regex and can be used as such.
There are some different ways how we can use groups.

| Name | Usage | RegExp | Description | | ------------------- | ----------------------------------------------------------------------- | --------------------------- | --------------------------------------------- | | Capture enclosed | [...] | (...) | Capture everything enclosed | | Atomic capture | ATMOIC [...] | (?>...) | Atmoic group (non-capturing) | | Named group | NAME "Foo" FOR [...] | (?<Foo>) | Named capturing group | | Define group * | DEFINE "Foo" FOR [...] | | Defines a group for later use | | Positive lookahead | POSITIVE LOOKAHEAD [...] | (?=...) | Positive lookahead | | Negative lookahead | NEGATIVE LOOKAHEAD [...] | (?!...) | Negative lookahead | | Positive lookbehind | POSITIVE LOOKBEHIND [...] | (?<=...) | Positive lookbehind | | Negative lookbehind | NEGATIVE LOOKBEHIND [...] | (?<!...) | Negative lookbehind | | If branching | IF ([LITERAL ("foo")]) THEN [LITERAL ("Bar")] ELSE [LITERAL ("barFoo")] | (((?=foo)fooBar)|(barFoo)) | Allows to go through different regex branches |

* Is not supported by the Emacs RegExp Engine, but its implemented via SRL

Quantifiers

Quantifiers are used to define how often the last element should be repeated.

| Name | Usage | RegExp | Description | | ---------------- | ----------------------------- | ------ | --------------------- | | Optional | LITERAL ("a") OPTIONAL | a? | 0 or 1 of a | | Zero or More* | LITERAL ("a") MANY | a* | 0 or more of a | | One or More | LITERAL ("a") MANY1 | a+ | 1 or more of a | | Exact | LITERAL ("a") EXACT ($3) | a{3} | Exactly 3 of a | | More than | LITERAL ("a") MORE ($3) | a{3,} | 3 or more of a | | Less than *** | LITERAL ("a") LESS ($3) | a{0,3} | 3 or less of a | | Between | LITERAL ("a") BETWEEN ($3 $6) | a{3,6} | Between 3 and 6 of a | | Greedy** | LITERAL ("a") GREEDY | a* | Greedy quantifier | | Lazy | LITERAL ("a") LAZY | a*? | Lazy quantifier | | Possessive | LITERAL ("a") POSSESSIVE | a*+ | Possessive quantifier |

* Is replaceable with GREEDY
** Is replaceable with MANY
*** Is not supported by the Emacs RegExp Engine, but its implemented via SRL

Instructions

Instructions are used to define your patterns.

| Name | Usage | RegExp | Description | | ------------- | ------------------------------ | ------ | -------------------------- | | From | FROM ("123") | [123] | Single char of | | Except | EXCEPT ("123") | [^123] | Any other char than | | Literal | LITERAL ("a") | a | Whole string matches | | Or | LITERAL ("a") OR LTIERAL ("b") | a|b | a or b | | Subroutine * | SUBROUTINE("test") | | Matches a predefined group |

* Custom implementation, this feature is not a part of the default regex engine for ecmascript

Flags

Flags are used to set the modes in the RegExp parser

| Name | Usage | Description | | ---------------- | ---------------- | ----------------------------------------------------------------- | | Global | GLOBAL | Does not stop after first match | | Multiline | MULTILINE | ^ and $ match the start and end of the line | | Case insensitive | CASE INSENSITIVE | Matches capital letters and non-captial letters as the same | | Single line | SINGLE LINE | Reads whole input as one line | | Unicode | UNICODE | Strings will be treated as UTF-16 | | STICKY | STICKY | Forces pattern to anchor at start of the search or the last match |

* Also called "Ignore Whitespace"