The Js Collection of Regular Expressions
A handmade collection of regular expressions for JavaScript.
Fully tested and documented.
Mainly assisted by github copilot and tweaked by me.
Ready to be imported or copy pasted into your code.
Scope
-
numbers
- integers
- floats
- hexadecimals
- octal
- binary
- Roman numerals
- base64
- base32
- bigInt
-
emails
-
uris
- url
- hostname
- ipv4
- ipv4 CIDR
- ipv6
- ipv6 CIDR
- subnet masks
- private ips v4
- private ips v6
- uri
- uri protocols/schemes
-
colors
- hex
- rgb
- hsl
- hsv
- cmyk
-
eval JS
- JS reserved words
- JS Identifier Name (variable/function/class names)
- JS classic function
- JS arrow function
- JS class
- JS anonymous function
- JS generator function
- JS async function
- JS async generator function
- JS global scope variables (Deno, Node, Browser)
- JS pure function
-
case
- camelCase
- kebab-case
- snake_case
- PascalCase
- CONSTANT_CASE
-
dates
-
time
-
currency
-
phone numbers
-
postal codes
-
credit
-
uuid
-
iban
-
bic
-
json
-
html tags
-
mime types
-
file extensions
-
mac addresses
-
passwords
-
credit card
-
semver
-
conventional commit messages
-
git references
Contributing
Sources of inspiration
https://www.npmjs.com/package/regexpattern-collection
https://www.npmjs.com/package/regexps
https://github.com/fonsecapontes/Regex-Awesome
https://github.com/OpenCode/awesome-regex
https://github.com/dunizb/JS-Regular-expression-awesome
https://github.com/agungnursatria/regexpattern/blob/master/lib/src/regex_pattern.dart
https://github.com/1337z/regex-collection/blob/master/src/index.ts
https://github.com/lukehaas/RegexHub/blob/master/src/data/index.js
https://regex101.com/library?filterFlavors=javascript&orderBy=MOST_POINTS&search=
https://regexlib.com/UserPatterns.aspx?authorId=a31a0874-118f-4550-933e-a7c575d149ae
https://github.com/Archakov06/rgxp/blob/master/src/assets/patterns.json
https://github.com/nicoandresr/regexlib/blob/master/index.ts
https://atrilsolutions.zendesk.com/hc/en-us/articles/205539861-Useful-regular-expressions
Add Package
deno add jsr:@garn/regexp
Import symbol
import * as regexp from "@garn/regexp";
Import directly with a jsr specifier
import * as regexp from "jsr:@garn/regexp";
Add Package
pnpm i jsr:@garn/regexp
pnpm dlx jsr add @garn/regexp
Import symbol
import * as regexp from "@garn/regexp";
Add Package
yarn add jsr:@garn/regexp
yarn dlx jsr add @garn/regexp
Import symbol
import * as regexp from "@garn/regexp";
Add Package
vlt install jsr:@garn/regexp
Import symbol
import * as regexp from "@garn/regexp";
Add Package
npx jsr add @garn/regexp
Import symbol
import * as regexp from "@garn/regexp";
Add Package
bunx jsr add @garn/regexp
Import symbol
import * as regexp from "@garn/regexp";