Библиотека регулярных выражений

Коллекция распространённых шаблонов регулярных выражений с поиском

Показано 46 шаблонов
Email Address
email-urls

Matches standard email addresses

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$
Совпадение [email protected]
Нет совпадения [email protected]
URL with Protocol
email-urls

Matches HTTP/HTTPS URLs

^https?:\/\/(www\.)?[a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)$
Совпадение https://example.com/path
Нет совпадения ftp://file.txt
Domain Name
email-urls

Matches domain names without protocol

^([a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$
Совпадение sub.example.com
Нет совпадения -invalid.com
Slug (URL-friendly)
email-urls

Matches URL slugs

^[a-z0-9]+(-[a-z0-9]+)*$
Совпадение my-blog-post
Нет совпадения My Blog Post
Integer
numbers

Matches positive or negative integers

^-?\d+$
Совпадение -42
Нет совпадения 3.14
Decimal Number
numbers

Matches decimal numbers

^-?\d+\.\d+$
Совпадение 3.14
Нет совпадения 42
Hex Color Code
numbers

Matches hex color codes

^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$
Совпадение #ff5733
Нет совпадения #xyz
Binary Number
numbers

Matches binary strings

^[01]+$
Совпадение 10110
Нет совпадения 102
Octal Number
numbers

Matches octal numbers

^0[0-7]+$
Совпадение 0755
Нет совпадения 089
Scientific Notation
numbers

Matches numbers in scientific notation

^-?\d+(\.\d+)?[eE][+-]?\d+$
Совпадение 1.5e10
Нет совпадения 1.5x10
Date (YYYY-MM-DD)
dates

Matches ISO 8601 date format

^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$
Совпадение 2024-01-15
Нет совпадения 2024-13-01
Date (MM/DD/YYYY)
dates

Matches US date format

^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$
Совпадение 01/15/2024
Нет совпадения 13/01/2024
Date (DD/MM/YYYY)
dates

Matches European date format

^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$
Совпадение 15/01/2024
Нет совпадения 32/01/2024
Time (HH:MM:SS)
dates

Matches 24-hour time format

^([01]\d|2[0-3]):[0-5]\d:[0-5]\d$
Совпадение 14:30:00
Нет совпадения 25:00:00
ISO 8601 DateTime
dates

Matches ISO 8601 datetime

^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})$
Совпадение 2024-01-15T14:30:00Z
Нет совпадения 2024-01-15 14:30
US Phone Number
phone

Matches US phone numbers

^\(?\d{3}\)?[-\s]?\d{3}[-\s]?\d{4}$
Совпадение (555) 123-4567
Нет совпадения 123-45-6789
International Phone
phone

Matches E.164 international phone format

^\+?[1-9]\d{1,14}$
Совпадение +14155552671
Нет совпадения +0123
UK Phone Number
phone

Matches UK phone numbers

^(\+44|0)\d{10}$
Совпадение +447911123456
Нет совпадения +44123
Strong Password
passwords

At least 8 chars: uppercase, lowercase, digit, special

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$
Совпадение Str0ng!Pass
Нет совпадения weakpass
Medium Password
passwords

At least 6 chars: uppercase, lowercase, digit

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[A-Za-z\d]{6,}$
Совпадение Pass12
Нет совпадения pass
PIN Code (4-6 digits)
passwords

Matches 4 to 6 digit PIN codes

^\d{4,6}$
Совпадение 1234
Нет совпадения 123
Unix File Path
file-paths

Matches Unix/Linux file paths

^\/([a-zA-Z0-9._-]+\/)*[a-zA-Z0-9._-]+$
Совпадение /usr/local/bin/node
Нет совпадения C:\folder
Windows File Path
file-paths

Matches Windows file paths

^[a-zA-Z]:\\([^\\/:*?"<>|]+\\)*[^\\/:*?"<>|]+$
Совпадение C:\Users\file.txt
Нет совпадения /usr/local
File Extension
file-paths

Matches file extensions

\.[a-zA-Z0-9]{1,10}$
Совпадение file.txt
Нет совпадения noextension
Image File
file-paths

Matches common image file extensions

\.(jpg|jpeg|png|gif|bmp|svg|webp)$
Совпадение photo.jpg
Нет совпадения doc.pdf
HTML Tag
html-xml

Matches paired HTML tags with content

<([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>.*?<\/\1>
Совпадение <div>hello</div>
Нет совпадения <br/>
Self-closing Tag
html-xml

Matches self-closing HTML/XML tags

<[a-zA-Z][a-zA-Z0-9]*\b[^>]*\/>
Совпадение <br/>
Нет совпадения <div></div>
HTML Comment
html-xml

Matches HTML comments

<!--[\s\S]*?-->
Совпадение <!-- comment -->
Нет совпадения // comment
HTML Entity
html-xml

Matches HTML entities

&[a-zA-Z]+;|&#\d+;|&#x[a-fA-F0-9]+;
Совпадение &amp;
Нет совпадения & amp
IPv4 Address
network

Matches IPv4 addresses

^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$
Совпадение 192.168.1.1
Нет совпадения 256.1.1.1
IPv6 Address
network

Matches full IPv6 addresses

^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$
Совпадение 2001:0db8:85a3:0000:0000:8a2e:0370:7334
Нет совпадения 192.168.1.1
MAC Address
network

Matches MAC addresses

^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$
Совпадение 00:1B:44:11:3A:B7
Нет совпадения 00:1B:44
Port Number
network

Matches valid port numbers (1-65535)

^([1-9]\d{0,3}|[1-5]\d{4}|6[0-4]\d{3}|65[0-4]\d{2}|655[0-2]\d|6553[0-5])$
Совпадение 8080
Нет совпадения 70000
Subnet Mask (CIDR)
network

Matches CIDR notation

^\/(3[0-2]|[12]?\d)$
Совпадение /24
Нет совпадения /33
Visa Card
credit-cards

Matches Visa card numbers

^4[0-9]{12}(?:[0-9]{3})?$
Совпадение 4111111111111111
Нет совпадения 5111111111111111
Mastercard
credit-cards

Matches Mastercard numbers

^5[1-5][0-9]{14}$
Совпадение 5500000000000004
Нет совпадения 4111111111111111
American Express
credit-cards

Matches American Express card numbers

^3[47][0-9]{13}$
Совпадение 378282246310005
Нет совпадения 4111111111111111
Any Credit Card
credit-cards

Matches Visa, MC, Amex, Discover

^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|3[47][0-9]{13}|6(?:011|5[0-9]{2})[0-9]{12})$
Совпадение 4111111111111111
Нет совпадения 1234567890
CVV
credit-cards

Matches 3 or 4 digit CVV codes

^\d{3,4}$
Совпадение 123
Нет совпадения 12
UUID v4
identifiers

Matches UUID version 4

^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
Совпадение 550e8400-e29b-41d4-a716-446655440000
Нет совпадения 550e8400
SSN (US)
identifiers

Matches US Social Security Numbers

^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$
Совпадение 123-45-6789
Нет совпадения 000-00-0000
Hex String
identifiers

Matches hexadecimal strings

^[0-9a-fA-F]+$
Совпадение deadbeef
Нет совпадения ghijkl
MD5 Hash
identifiers

Matches MD5 hash strings

^[a-fA-F0-9]{32}$
Совпадение d41d8cd98f00b204e9800998ecf8427e
Нет совпадения abc123
SHA-256 Hash
identifiers

Matches SHA-256 hash strings

^[a-fA-F0-9]{64}$
Совпадение e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
Нет совпадения short
JSON Web Token
identifiers

Matches JWT token structure

^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$
Совпадение eyJhbGci.eyJzdWIi.SflKxwRJ
Нет совпадения not.a.jwt.token
Semantic Version
identifiers

Matches semantic versioning (semver)

^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[\da-zA-Z-]+(\.[\da-zA-Z-]+)*)?(\+[\da-zA-Z-]+(\.[\da-zA-Z-]+)*)?$
Совпадение 1.2.3-beta.1
Нет совпадения 1.2

Библиотека регулярных выражений

Коллекция распространённых шаблонов регулярных выражений с поиском

Возможности

  • 46 ready-to-use regex patterns across 11 categories: Email, URLs, Numbers, Dates, Phones, Passwords, File Paths, HTML/XML, Network, Credit Cards, Identifiers
  • Test any pattern against your input text right in the page
  • Patterns are practical / pragmatic — the email pattern catches the common 95% rather than chasing RFC 5322's full complexity
  • Copy any pattern to clipboard with one click
  • Patterns include explanatory examples in the description

Как использовать

  1. Просматривайте категории или используйте поле поиска, чтобы найти шаблоны.
  2. Ознакомьтесь с шаблоном регулярного выражения, его описанием и примерами.
  3. Нажмите кнопку копирования, чтобы скопировать регулярное выражение в буфер обмена.

Советы и лучшие практики

  • The "email" regex is the canonical compromise: short, fast, catches typos. For full RFC 5322 compliance use the multi-thousand-character version (you almost never need it).
  • For password strength, the included pattern is a "minimum acceptable" check — use the password-strength-checker tool for nuanced scoring.
  • Regex is great for validation, terrible for parsing. Use a dedicated parser for HTML, JSON, dates with timezones, etc.
  • JavaScript regex doesn't support recursive patterns — for nested-bracket matching, use a real parser.
  • For multi-line input, set the `m` flag so `^` / `$` match line starts/ends, and the `s` flag to make `.` match newlines.

Вопросы и ответы

Готовы ли эти шаблоны регулярных выражений к использованию в продакшене?

Эти шаблоны покрывают распространённые сценарии и подходят для большинства приложений. Для критической валидации учитывайте крайние случаи, специфичные для ваших требований.

Какой диалект регулярных выражений используют эти шаблоны?

Эти шаблоны используют синтаксис регулярных выражений, совместимый с JavaScript, который работает в большинстве современных языков программирования с минимальными изменениями.

Бесплатен ли этот инструмент?

Да, этот инструмент полностью бесплатен и не требует регистрации. Нет ограничений использования, платных уровней или скрытых платежей.

Безопасны ли мои данные и конфиденциальны?

Безусловно. Вся обработка происходит локально в вашем браузере. Никакие данные не отправляются на наши серверы или третьим лицам.

Работает ли этот инструмент офлайн?

После загрузки страницы инструмент полностью работает в вашем браузере без подключения к Интернету.