Platform
Regex Library
Collection of useful regular expressions
Regex Tester
Edit the pattern, toggle flags, and see live matches highlighted.
/
/
0.02ms
Flags: gi
Supports capture groups and named groups. Example: Hello, $1 or $&.
source: /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}/flags: gimatches: 2
Hand-picked patterns, ready to copy.
Email (simple, practical)
WebBasic RFC-lite email matcher for most use cases.
/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[A-Za-z]{2,}/gURL (http/https)
WebMatches common http/https URLs with optional query/hash.
/https?:\/\/[^\s/$.?#].[^\s]*/giSample
Visit https://tariqul.dev or http://example.org?q=1#top
Slug (kebab-case)
WebLowercase letters, digits and hyphens.
/^[a-z0-9]+(?:-[a-z0-9]+)*$/Sample
projects, my-project-01
HTML tag
WebFind HTML tags with attributes.
/<("[^"]*"|'[^']*'|[^'">])*>/gSample
<div class='box'>Hello</div>
YouTube Video ID
WebExtract 11-char YouTube video ID from URL.
/(?:youtube\.com\/(?:[^\/\n\s]+\/\S+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([A-Za-z0-9_-]{11})/iSample
https://youtu.be/abc123XYZ09
Integer (signed)
NumbersOptional leading +/-, then digits.
/^[+-]?\d+$/Sample
-42, 0, +99
Number (int/float)
NumbersOptional sign, optional decimals.
/^[+-]?(?:\d+\.?\d*|\.\d+)$/Sample
3, -2.5, .75, +10.0
Currency (BDT style)
NumbersDigits with optional commas and decimals.
/^\d{1,3}(?:,\d{3})*(?:\.\d{1,2})?$/Sample
1,200,500.00
Roman numeral
NumbersMatch Roman numerals up to 3999.
/^(?=[MDCLXVI])M*(C[MD]|D?C{0,3})(X[CL]|L?X{0,3})(I[XV]|V?I{0,3})$/iSample
XIV, MMXXV
Percentage (0-100%)
NumbersNumber between 0–100 with % sign.
/^(100(\.0+)?|[0-9]?\d(\.\d+)?)%$/Sample
25%, 99.5%, 100%
Strong password (8+ with mix)
SecurityAt least 8 chars, upper, lower, number, symbol.
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\w\s]).{8,}$/Sample
Aa1!aaaa
Hex color (#RGB/#RRGGBB)
Security3 or 6 hex digits after #.
/^#(?:[0-9a-fA-F]{3}){1,2}$/Sample
#0fa, #0F0F0F
JWT token
SecurityThree base64url encoded parts separated by dots.
/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$/Sample
eyJhbGciOi...abc.def.ghi
UUID v4
SystemCanonical lowercase/uppercase variants.
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/Sample
123e4567-e89b-12d3-a456-426614174000
IPv4 address
System0–255 dot-separated quads.
/^(?:25[0-5]|2[0-4]\d|1?\d?\d)(?:\.(?:25[0-5]|2[0-4]\d|1?\d?\d)){3}$/Sample
192.168.0.1
IPv6 address
SystemMatches most IPv6 formats.
/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|(::1)|::)$/iSample
2001:0db8:85a3:0000:0000:8a2e:0370:7334
MAC address
System6 pairs of hex digits separated by : or -.
/^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/Sample
00:1A:2B:3C:4D:5E
Trim extra spaces (find)
TextMultiple spaces for replacement.
/\s{2,}/gSample
hello world
Words (ASCII)
TextWord tokens split.
/\b\w+\b/gSample
This is a test.
Hashtags
TextFind #hashtags in text.
/#\w+/gSample
Loving #ToolsCube and #regex
Mentions (@username)
TextFind Twitter/Instagram style mentions.
/@\w+/gSample
Thanks @tariqul_dev
Bangladesh mobile (+880 / 01)
BanglaTypical Bangladeshi mobile formats.
/^(?:\+?88)?01[3-9]\d{8}$/Sample
+8801712345678, 01712345678
Bangla letters
BanglaMatches Bangla letters (একাধিক).
/[\u0980-\u09FF]+/gSample
আমার সোনার বাংলা
Bangla numbers
Bangla০–৯ বাংলা সংখ্যা match করে।
/[০-৯]+/gSample
১২৩৪৫৬৭৮৯০
Favorites
Save and reuse your most common patterns.
No favorites yet. Click Save Favorite above to store the current pattern.
Regex Cheatsheet
Common tokens, anchors & quantifiers (JS flavor).
Anchors
^start of string$end of string\bword boundary
Character Classes
\ddigit,\wword,\swhitespace.any char (except newline unlesss)[abc]set,[^abc]negated
Groups & Quantifiers
( )capture,(?: )non-capture(?<name> )named capture?,*,+,{m,n}(add?for lazy)