Dev Tools
NextJs Demo
Image Format ConverterBeautify & MinifyPDF Tools
ss

REGEX MEMO

Normal characters

ExpressionDescription
. or [^

] | any character excluding a newline or carriage return [A-Za-z] | alphabet [a-z] | lowercase alphabet [A-Z] | uppercase alphabet d or [0-9] | digit D or [^0-9] | non-digit _ | underscore w or [A-Za-z0-9_] | alphabet, digit or underscore W or [^A-Za-z0-9_] | inverse of w S | inverse of s

Whitespace characters

ExpressionDescription
space
 | tab

| newline

| carriage return s | space, tab, newline or carriage return

Character set

ExpressionDescription
[xyz]either x, y or z
[^xyz]neither x, y nor z
[1-3]either 1, 2 or 3
[^1-3]neither 1, 2 nor 3
  • Think of a character set as an OR operation on the single characters that are enclosed between the square brackets.
  • Use ^ after the opening [ to "negate" the character set.
  • Within a character set, . means a literal period.

Characters that require escaping

Outside a character set

ExpressionDescription
.period
^caret
$dollar sign
|pipe
\back slash
/forward slash
(opening bracket
)closing bracket
[opening square bracket
]closing square bracket
{opening curly bracket
}closing curly bracket

Inside a character set

ExpressionDescription
\back slash
]closing square bracket
  • A ^ must be escaped only if it occurs immediately after the opening [ of the character set.
  • A - must be escaped only if it occurs between two alphabets or two digits.

Quantifiers

ExpressionDescription
{2}exactly 2
{2,}at least 2
{2,7}at least 2 but no more than 7
  • | 0 or more
  • | 1 or more ? | exactly 0 or 1
  • The quantifier goes after the expression to be quantified.

Boundaries

ExpressionDescription
^start of string
$end of string
word boundary
  • How word boundary matching works:
    • At the beginning of the string if the first character is w.
    • Between two adjacent characters within the string, if the first character is w and the second character is W.
    • At the end of the string if the last character is w.

Matching

ExpressionDescription
foobar
foo(?=bar)match foo if it's before bar
foo(?!bar)match foo if it's not before bar
(?<=bar)foomatch foo if it's after bar
(?<!bar)foomatch foo if it's not after bar

Grouping and capturing

ExpressionDescription
(foo)capturing group; match and capture foo
(?:foo)non-capturing group; match foo but without capturing foo
(foo)bar\1\1 is a backreference to the 1st capturing group; match foobarfoo
  • Capturing groups are only relevant in the following methods:
    • string.match(regexp)
    • string.matchAll(regexp)
    • string.replace(regexp, callback)
  • \N is a backreference to the Nth capturing group. Capturing groups are numbered starting from 1.

References and tools

Related Tools in Utility Tools

Basic Auth Generator

Generate the 'Authorization' header value for HTTP Basic Authentication.

bcrypt

A tool for hashing and verifying passwords using the bcrypt algorithm.

Benchmark Builder

Convert between different date formats

BIP39 Generator

Generate BIP39 mnemonic phrases for creating deterministic cryptocurrency wallets.

Camera Recorder

Record video directly from your webcam or camera in your browser.

Chronometer

A simple and accurate online stopwatch to measure elapsed time.

Crontab Generator

Easily create and schedule cron jobs with a user-friendly interface.

Device Information

View detailed information about your current device and browser.

Docker Run to Docker Compose Converter

Convert 'docker run' commands into a 'docker-compose.yml' file format.

Email Normalizer

Normalize email addresses by removing dots and plus aliases (e.g., for Gmail).

Emoji Picker

Quickly find, copy, and paste emojis for your messages and documents.

Encryption

Encrypt and decrypt text using various standard encryption algorithms.

GIT Memoizer

A handy cheatsheet and memoizer for common Git commands.

iBan Validator and Parser

Validate and parse International Bank Account Numbers (IBANs).

iPV4 Address Converter

Convert IPv4 addresses between decimal, binary, and hexadecimal formats.

iPV4 Range Expander

Expand a given IPv4 address range or CIDR notation into a list of all IPs.

iPV4 Subnet Calculator

Calculate subnet details like network address, broadcast address, and host range.

iPV6 ULA Generator

Generate Unique Local Addresses (ULAs) for IPv6 networks.

iPV6ULA Validator

Validate if an IPv6 address is a Unique Local Address (ULA).

JWT Parser

Decode and inspect the header, payload, and signature of a JSON Web Token (JWT).

Keycode Info

Press any key to get its JavaScript event key, code, and which values.

MAC Address Generator

Generate random MAC addresses for testing or network configuration.

MAC Address Lookup

Find the manufacturer of a device by looking up its MAC address.

Math Evaluator

A powerful online calculator that can evaluate complex mathematical expressions.

MIMI Types

A quick reference and search tool for common MIME types.

Numeronym Generator

Create numeronyms (like i18n for internationalization) from words.

OTP Code Generator and Validator

Generate and validate Time-based One-Time Passwords (TOTP) for 2FA.

Password Strength Analyser

Convert between different date formats

Phone Parser and Formatter

Parse, validate, and format international phone numbers.

QR Code Generator

Generate QR codes for URLs, text, Wi-Fi credentials, and more.

Random Port Generator

Generate a random network port number within a specified range.

Regex Memo

A cheatsheet and tester for common regular expressions.

Regex Tester

Test and debug your regular expressions against sample text in real-time.

RSA Key Pair Generator

Generate public and private RSA key pairs for encryption and digital signatures.

Safelink Decoder

Decode Microsoft Outlook's Safe Links to reveal the original URL.

Slugify String

Convert any string into a URL-friendly slug.

Token Generator

Generate random, secure tokens or API keys of a specified length.

Ulid Generator

Generate Universally Unique Lexicographically Sortable Identifiers (ULIDs).

URL Encoder

Encode or decode URLs and strings according to RFC 3986.

URL Parser

Break down a URL into its components: protocol, hostname, path, query, etc.

User Agent Parser

Parse a user-agent string to identify the browser, OS, and device.

Wifi QR Code Generator

Create a QR code that allows others to connect to your Wi-Fi network easily.