Skip to main content
CheckTown

Regex-bibliotheek

Blader door veelgebruikte regex-patronen per categorie

Test uw patronen in onze Regex Tester

E-mail

Simple Email

^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$

Matches a basic email address format

Overeenkomst: user@example.comGeen overeenkomst: user@.com

Email with Display Name

^[^<]*<[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}>$

Matches an email with a display name like "John Doe <john@example.com>"

Overeenkomst: John Doe <john@example.com>Geen overeenkomst: john@example.com

Email Domain Extraction

@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})

Extracts the domain part from an email address

Overeenkomst: user@example.comGeen overeenkomst: no-at-sign-here

No-Reply Email

^no-?reply@

Matches email addresses starting with no-reply or noreply

Overeenkomst: no-reply@example.comGeen overeenkomst: contact@example.com

URL

URL with Protocol

^https?:\/\/[^\s/$.?#].[^\s]*$

Matches a URL starting with http:// or https://

Overeenkomst: https://example.com/pathGeen overeenkomst: ftp://example.com

URL Slug

^[a-z0-9]+(?:-[a-z0-9]+)*$

Matches a URL-safe slug with lowercase letters, numbers, and hyphens

Overeenkomst: my-blog-postGeen overeenkomst: My Blog Post

Domain Name

^(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$

Matches a valid domain name like example.com or sub.domain.org

Overeenkomst: sub.example.comGeen overeenkomst: -invalid.com

URL Query Parameter

[?&]([^=]+)=([^&]*)

Extracts key=value pairs from URL query strings

Overeenkomst: ?name=John&age=30Geen overeenkomst: /path/without/params

YouTube Video ID

(?:youtube\.com\/watch\?v=|youtu\.be\/)([a-zA-Z0-9_-]{11})

Extracts the 11-character video ID from YouTube URLs

Overeenkomst: https://youtu.be/dQw4w9WgXcQGeen overeenkomst: https://vimeo.com/12345

Datum & tijd

ISO 8601 Date

^\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])$

Matches dates in ISO 8601 format (YYYY-MM-DD)

Overeenkomst: 2024-12-31Geen overeenkomst: 31-12-2024

Date (MM/DD/YYYY)

^(0[1-9]|1[0-2])\/(0[1-9]|[12]\d|3[01])\/\d{4}$

Matches dates in US format (MM/DD/YYYY)

Overeenkomst: 12/31/2024Geen overeenkomst: 31/12/2024

Date (DD/MM/YYYY)

^(0[1-9]|[12]\d|3[01])\/(0[1-9]|1[0-2])\/\d{4}$

Matches dates in European format (DD/MM/YYYY)

Overeenkomst: 31/12/2024Geen overeenkomst: 2024-12-31

24-Hour Time

^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$

Matches time in 24-hour format with optional seconds

Overeenkomst: 23:59:59Geen overeenkomst: 25:00

12-Hour Time

^(0?[1-9]|1[0-2]):[0-5]\d\s?(?:AM|PM|am|pm)$

Matches time in 12-hour format with AM/PM

Overeenkomst: 2:30 PMGeen overeenkomst: 13:30 PM

Nummer

Integer

^-?\d+$

Matches positive or negative whole numbers

Overeenkomst: -42Geen overeenkomst: 3.14

Decimal Number

^-?\d+\.?\d*$

Matches positive or negative numbers with optional decimal part

Overeenkomst: 3.14Geen overeenkomst: abc

Hex Color

^#(?:[0-9a-fA-F]{3}){1,2}$

Matches 3 or 6 digit hex color codes with # prefix

Overeenkomst: #ff6600Geen overeenkomst: #gggggg

Currency (USD)

^\$\d{1,3}(,\d{3})*(\.\d{2})?$

Matches US dollar amounts with optional cents and thousands separators

Overeenkomst: $1,234.56Geen overeenkomst: 1234.56

Percentage

^-?\d+(\.\d+)?%$

Matches percentage values with optional decimal part

Overeenkomst: 99.9%Geen overeenkomst: 99.9

Telefoon

International Phone

^\+?[1-9]\d{1,14}$

Matches international phone numbers in E.164 format

Overeenkomst: +14155552671Geen overeenkomst: 0000000

US Phone

^(\+1)?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$

Matches US phone numbers in various formats

Overeenkomst: (415) 555-2671Geen overeenkomst: 123

Phone with Extension

^(\+?\d{1,3})?[-.\s]?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}(\s*(ext|x|ext.)\s*\d{2,5})?$

Matches phone numbers with optional country code and extension

Overeenkomst: +1 415-555-2671 ext 1234Geen overeenkomst: not-a-phone

Digits Only (Phone)

^\d{10,15}$

Matches phone numbers as digit-only strings (10 to 15 digits)

Overeenkomst: 4155552671Geen overeenkomst: 12345

IP & netwerk

IPv4 Address

^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$

Matches a valid IPv4 address (0.0.0.0 to 255.255.255.255)

Overeenkomst: 192.168.1.1Geen overeenkomst: 256.1.1.1

IPv4 with Port

^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?):(\d{1,5})$

Matches an IPv4 address followed by a port number

Overeenkomst: 192.168.1.1:8080Geen overeenkomst: 192.168.1.1

IPv6 Address

^(?:[0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$

Matches a full IPv6 address (8 groups of hex digits)

Overeenkomst: 2001:0db8:85a3:0000:0000:8a2e:0370:7334Geen overeenkomst: 192.168.1.1

MAC Address

^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$

Matches a MAC address with colon or dash separators

Overeenkomst: 00:1A:2B:3C:4D:5EGeen overeenkomst: 001A2B3C4D5E

CIDR Notation

^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\/(?:3[0-2]|[12]?\d)$

Matches an IPv4 address with CIDR subnet notation

Overeenkomst: 192.168.1.0/24Geen overeenkomst: 192.168.1.0/33

Bestand & pad

File Extension

\.([a-zA-Z0-9]+)$

Extracts the file extension from a filename

Overeenkomst: document.pdfGeen overeenkomst: no-extension

Unix File Path

^\/(?:[^\/ ]+\/)*[^\/ ]+$

Matches an absolute Unix/Linux file path

Overeenkomst: /usr/local/bin/nodeGeen overeenkomst: relative/path

Windows File Path

^[a-zA-Z]:\\(?:[^\\/:*?"<>|\r\n]+\\)*[^\\/:*?"<>|\r\n]*$

Matches an absolute Windows file path

Overeenkomst: C:\Users\docs\file.txtGeen overeenkomst: /usr/local/bin

Image File

\.(jpe?g|png|gif|bmp|svg|webp|ico|tiff?)$

Matches filenames with common image extensions

Overeenkomst: photo.jpgGeen overeenkomst: script.js

Wachtwoord

Min 8 Characters

^.{8,}$

Matches any string with at least 8 characters

Overeenkomst: password123Geen overeenkomst: short

Strong Password

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$

Requires uppercase, lowercase, digit, and special character (min 8 chars)

Overeenkomst: P@ssw0rd!Geen overeenkomst: password

No Spaces

^\S+$

Matches strings that contain no whitespace characters

Overeenkomst: no-spaces-hereGeen overeenkomst: has spaces

Alphanumeric Only

^[a-zA-Z0-9]+$

Matches strings containing only letters and digits

Overeenkomst: abc123Geen overeenkomst: hello world!

HTML & XML

HTML Tag

<\/?[a-zA-Z][a-zA-Z0-9]*[^>]*>

Matches opening and closing HTML tags

Overeenkomst: <div class="test">Geen overeenkomst: plain text

HTML Comment

<!--[\s\S]*?-->

Matches HTML comments including multiline content

Overeenkomst: <!-- comment -->Geen overeenkomst: // js comment

HTML Attribute

([a-zA-Z-]+)\s*=\s*"([^"]*)"

Extracts attribute name and value pairs from HTML elements

Overeenkomst: class="active"Geen overeenkomst: no-attribute

Self-Closing Tag

<[a-zA-Z][a-zA-Z0-9]*[^>]*\/>

Matches self-closing HTML/XML tags like <br /> or <img />

Overeenkomst: <img src="test.png" />Geen overeenkomst: <div>content</div>

Overige

UUID v4

^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$

Matches a UUID version 4 string (lowercase hex)

Overeenkomst: 550e8400-e29b-41d4-a716-446655440000Geen overeenkomst: not-a-uuid

JWT Token

^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+$

Matches the three-part structure of a JSON Web Token

Overeenkomst: eyJhbGci.eyJzdWIi.SflKxwRJGeen overeenkomst: not.a.jwt.token

Markdown Link

\[([^\]]+)\]\(([^)]+)\)

Matches Markdown-style links [text](url)

Overeenkomst: [Google](https://google.com)Geen overeenkomst: plain text link

Semantic Version

^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*))?$

Matches semantic version strings like 1.2.3 or v2.0.0-beta.1

Overeenkomst: v2.1.0-beta.1Geen overeenkomst: 1.2

Base64 String

^[A-Za-z0-9+/]*={0,2}$

Matches valid Base64-encoded strings

Overeenkomst: SGVsbG8gV29ybGQ=Geen overeenkomst: Hello World!!!

Meer informatie

Regex-bibliotheek: Veelgebruikte patronen die u echt nodig hebt

Blader door een samengestelde verzameling regex-patronen voor e-mail, URL, datum en meer.

Wat is een regex-bibliotheek?

Een regex-bibliotheek is een samengestelde collectie reguliere expressiepatronen voor veelvoorkomende validatie- en extractietaken. In plaats van elke keer regex vanaf nul te schrijven, kunt u geteste patronen voor emails, URL's, datums, IP-adressen en tientallen andere formaten doorzoeken.

Veelgestelde vragen