Please enable JavaScript to use regex101
Regular
Expressions
101
Support Regex101
Social
Info
Regex Editor
Community Patterns
Account
Regex Quiz
Settings
Order By
Most Recent
Most upvotes
Most downvotes
Highest Score
Lowest Score
Filter by Flavor
PCRE2 (PHP)
ECMAScript (JavaScript)
Python
Golang
Java
.NET 7.0 (C#)
Rust
PCRE (Legacy)
Sponsors
There are currently no sponsors.
Become a sponsor today!
Community Patterns
Search among community submitted regex patterns...
0/512
1
Flatten 1 line CSS
Created
·
2026-03-01 16:22
Updated
·
2026-03-01 17:35
Flavor
·
PCRE2 (PHP)
Finds CSS selectors that only contain one line and, using the substitution, flattens everything to be on the same line.
Submitted by
anonymous
1
IP address
Created
·
2026-03-01 02:22
Flavor
·
PCRE2 (PHP)
Matches and verifies IP address. 192.168.0.1 Matches 999.999.9.9 Didn't match
Submitted by
anonymous
1
Validate an IP
Created
·
2026-02-25 11:06
Updated
·
2026-02-25 11:11
Flavor
·
PCRE2 (PHP)
52 character long regex to validate IP address.
Submitted by
Karthik
1
number selector, with commas & decimals
Created
·
2026-02-12 05:04
Flavor
·
PCRE2 (PHP)
selects numbers, with commas and decimals, like 1,234.56
Submitted by
Bicorn
1
Smart outer parentheses selector with backslash escaping
Created
·
2026-02-10 03:26
Updated
·
2026-02-12 01:11
Flavor
·
PCRE2 (PHP)
Grabs the outer parentheses and contents taking into account inner parentheses enclosures
Submitted by
bicorn
1
nexus/sonartype composer cleanup of unfinished package versions
Created
·
2026-02-05 13:05
Flavor
·
PCRE2 (PHP)
matches composer packages with -alpha, -beta and -rc versionings
Submitted by
Anna Damm
1
OmegaT Project Name (Pattern)
Created
·
2026-02-03 16:49
Flavor
·
PCRE2 (PHP)
Regex showing how to match the five parts in an OmegaT project name (named as per the internal convention at cApStAn), including labels for each captured group (each part in the name).
Submitted by
msoutopico
2
Validate color with grb group
Created
·
2026-02-03 03:22
Updated
·
2026-02-04 03:36
Flavor
·
Golang
match: #aabbcc #abc (255,255,255) (255,255,255,255) 255,255,255 no match: #gggggg #ggg 256,256,256
Submitted by
Doyoung
1
unnecessary closing HTML tags
Created
·
2026-01-27 19:15
Flavor
·
PCRE2 (PHP)
Selects the ` and ` tags from a string. You can probably do this with something easier, but this works
Submitted by
Twineee
1
Door_Double
Created
·
2026-01-27 07:54
Updated
·
2026-01-28 10:27
Flavor
·
Python
Regex for Door_Double
Submitted by
anonymous
1
ตรวจสอบพยัญชนะต้นตัวสะกดสระและวรรณยุกต์ไทย
Created
·
2026-01-22 01:36
Updated
·
2026-01-23 12:42
Flavor
·
ECMAScript (JavaScript)
ตรวจสอบพยัญชนะต้น (ต้องมี) ตรวจตัวสะกดสำหรับสระที่ต้องมี ตรวจสอบการวางสระและวรรณยุกต์ไทย หมายเหตุ การตรวจสอบตัวสะกดในภาษาไทยตรวจสอบได้ยากเพราะภาษาไทยเป็นภาษาที่เขียนติด ๆ กันไม่มีการแบ่งคำอย่างชัดเจนทำให้การอ่านภาษาไทยผู้อ่านต้องใช้ความหมายของคำในการตัดสินการอ่านแบ่งคำตามความเหมาะสมเช่นคำว่า "ตากลม" อาจอ่านเป็น "ตาก-ลม" ก็ได้ หรืออ่านเป็น "ตา-กลม"ก็ได้ ดังนั้นการเขียน Regex เพื่อทำการตรวจสอบอาจช่วยได้ระดับหนึ่ง อ่าจมีผิดบ้างถูกบ้าง แต่ก็ถือว่าเป็นเครื่องมือที่ใช้ช่วยเหลือในการตรวจสอบเพิ่มเติมได้ 80% ของความเป็นไปใด้ก็แล้วกันนะครับ หวังว่าการเขียนเพิ่มเติมส่วนนี้ จะมีประโยชน์บ้างไม่มากก็น้อย
Submitted by
อธิปัตย์ ล้อวงศ์งาม
2
Secure Email Validation (OWASP-Aligned & DNS-Strict) (RFC 5322)
Created
·
2026-01-21 16:32
Updated
·
2026-01-21 16:36
Flavor
·
ECMAScript (JavaScript)
This regular expression provides a balance between RFC compliance and security-best-practices. It is designed to prevent injection vectors in legacy systems by using a restricted "safe" character subset recommended by the OWASP Validation Regex Repository. Pattern: ^A-Za-z0-9(?:\.A-Za-z0-9_+&-]+)*@(?:[A-Za-z0-9{0,61}[A-Za-z0-9])?\.)+[A-Za-z]{2,63}$ Key Features: Forced Alphanumeric Start: Prevents leading hyphens to avoid command injection vulnerabilities. Security Subset: Restricts special characters to _+&*- to prevent exotic character injections (e.g., pipes or backticks). No Quoted Strings: Forbids quoted strings to eliminate dangerous payloads containing spaces or backslashes. DNS Compliance: Enforces label lengths (1–63 characters) and prevents labels from starting or ending with hyphens. Whole String Anchoring: Uses ^ and $ to ensure the entire input is validated.
Submitted by
Gor Sargsyan
1
Laravel Log (MonoLog) Print
Created
·
2026-01-21 14:51
Updated
·
2026-01-21 15:00
Flavor
·
PCRE2 (PHP)
Extracts the following fields from a Laravel Log print: Time Stamp (Date) Log Level (supports optional prefix (ie. local.DEBUG)) Log Message Exception | Context If an exception is detected, the file reference (file path + line number), and optional stacktrace are captured.
Submitted by
Jerren
1
Poland PESEL
Created
·
2026-01-21 11:23
Flavor
·
PCRE2 (PHP)
Correct Poland PESEL base regex validator. Covers birth dates up to 2099 year. PESEL numbers are in YYMMDDXXXXX format, however, the month is adjusted based on what year people were born. People born from 1900-1999 has no adjustment, 2000-2099 is the month +20, 2100-2199 is +40, 2200-2299 is +60. For example, if someone was born December 16, 2016, their PESEL would be 163216XXXXX.
Submitted by
@Sldmk
1
PLF4 Formular mit Komponente
Created
·
2026-01-21 07:52
Flavor
·
PCRE2 (PHP)
PLF4
Submitted by
anonymous
1
PLF3
Created
·
2026-01-21 07:38
Flavor
·
PCRE2 (PHP)
PLF3
Submitted by
anonym
1
PLF2
Created
·
2026-01-21 07:22
Flavor
·
PCRE2 (PHP)
PLF2
Submitted by
anonym
1
PLF1
Created
·
2026-01-21 07:20
Flavor
·
PCRE2 (PHP)
plf1
Submitted by
anonym
1
Wasser
Created
·
2026-01-20 20:24
Flavor
·
PCRE2 (PHP)
hey das ist richtig coool oder?
Submitted by
anonymous
1
Python -- Match container image reference parts
Created
·
2026-01-20 02:14
Updated
·
2026-01-20 02:28
Flavor
·
Python
This is a Python RE for matching different parts and combinations of various docker/container image references, as compatible with docker pull etc. Parts / Capture Groups image: # whole image repo: # everything but the tag/digest registry: # host+port host: port: name: # path within registry reference: # tag or digest (with : or @; I haven't bothered to figure out how to strip that yet) tag: digest: If it matches, it should match image, repo, and name at the very least.
Submitted by
neal-ian
1
Check valid URI Scheme according to RFC2396
Created
·
2026-01-17 07:52
Flavor
·
Golang
Simple prefix matcher for validating URI Schemes according to [RFC2396, Section 3.1]( http://www.faqs.org/rfcs/rfc2396.html#3.5:~:text=well%20as%20%22http%22%29.-,scheme%20%20%20%20%20%20%20%20%3D%20alpha%20*%28%20alpha%20%7C%20digit%20%7C%20%22%2B%22%20%7C%20%22%2D%22%20%7C%20%22.%22%20%29,-Relative%20URI%20references) Go Playground: https://go.dev/play/p/vtYEugsNAfo
Submitted by
Gwyneth Llewelyn
1
URL, URI format validation
Created
·
2026-01-16 16:16
Updated
·
2026-01-16 23:25
Flavor
·
ECMAScript (JavaScript)
URL, URI format validation
Submitted by
Atipat Lorwongam
2
Regex Email Format
Created
·
2026-01-15 17:39
Updated
·
2026-01-16 23:26
Flavor
·
ECMAScript (JavaScript)
Used to check Email Format
Submitted by
Atipat Lorwongam
1
ตรวจสอบวรรณยุกต์และสระในภาษาไทย (รองรับการลากเสียงอาาาา)
Created
·
2026-01-15 17:20
Updated
·
2026-01-23 07:30
Flavor
·
ECMAScript (JavaScript)
ตรวจสอบการใช้วรรณยุกต์และสระในภาษาไทย รองรับการใช้สระอาาาาาติดกันแบบลากเสียง ไม่ตรวจสอบพยัญชนะต้นและตัวสะกด
Submitted by
อธิปัตย์ ล้อวงศ์งาม
1
ตรวจสอบวรรณยุกต์และสระในภาษาไทย
Created
·
2026-01-15 17:19
Updated
·
2026-01-23 07:29
Flavor
·
ECMAScript (JavaScript)
ใช้ตรวจสอบวรรณยุกต์และสระในภาษาไทย ไม่ตรวจสอบพยัญชนะต้นและตัวสะกด
Submitted by
อธิปัตย์ ล้อวงศ์งาม
1
Match instagram URLs
Created
·
2026-01-13 23:29
Flavor
·
PCRE2 (PHP)
Matches instagram urls for posts, reels, and stories works on all flavors except rust
Submitted by
User9684
1
Discord URL matching
Created
·
2026-01-13 23:19
Updated
·
2026-01-13 23:24
Flavor
·
PCRE2 (PHP)
match every type of discord url with each useful part in a group pretty optimized, shouldnt be too harsh on your system should work in every flavor except rust because rust sucks lol
Submitted by
User9684
1
Match Bible References
Created
·
2026-01-12 14:12
Flavor
·
PCRE2 (PHP)
I've created this for a simple project of mine, it squishes every book of the Bible into a RegEx, with the full name, abbreviation, and abbreviation with a dot. Then, it matches the chapter and verse relatively simply.
Submitted by
Twineee
1
cApStAn OmegaT flagged / disallowed text
Created
·
2026-01-11 22:28
Flavor
·
Java
Flagged / disallowed text expression used in cApStAn's build of OmegaT
Submitted by
msoutopico
1
cApStAn OmegaT custom tags
Created
·
2026-01-11 22:26
Flavor
·
Java
Custom tags expression used in cApStAn's build of OmegaT
Submitted by
msoutopico
1
Caculator seperator with groups
Created
·
2026-01-08 19:18
Flavor
·
PCRE2 (PHP)
Caculator seperator with groups
Submitted by
CalcMan
1
Simple CSS Selector parser
Created
·
2025-12-31 14:18
Updated
·
2025-12-31 14:22
Flavor
·
ECMAScript (JavaScript)
Basic Regex for CSS Selector. Pseudo-Elements, Combinators and other advanced stuff are not supported.
Submitted by
anonymous
1
HP Prime
Created
·
2025-12-30 04:20
Updated
·
2025-12-30 15:37
Flavor
·
PCRE2 (PHP)
Extracts HP Prime PPL numbers.
Submitted by
anonymous
1
Strings
Created
·
2025-12-30 04:09
Updated
·
2025-12-30 04:11
Flavor
·
PCRE2 (PHP)
Extracting strings defined in languages like C/C++ etc.
Submitted by
Insoft
1
1
Created
·
2025-12-28 04:09
Flavor
·
Python
554
Submitted by
anonymous
1
U.S. Phone Number
Created
·
2025-12-23 19:40
Flavor
·
PCRE2 (PHP)
Format validation for U.S. phone numbers with or without a country code and with various formatting and punctuation permissible.
Submitted by
Nick
1
AoC 2025 Day 5
Created
·
2025-12-19 23:04
Flavor
·
Python
AoC 2025 Day 5 part 1 but also works for part 2. You just don't need the IDs at the bottom for part 2
Submitted by
anonymous
1
Telephone validation regex - handles international codes, extensions, and formatting gracefully
Created
·
2025-12-19 21:17
Flavor
·
PCRE2 (PHP)
Search string for use in contact cleaning project $1 = intenational code, omitting preceding "+" $2 = area code $3 = first three digits of phone number $4 = last four digits of phone $5 = extension, inclusive of any commas or hashes to automate phone tree navigation TO DO handle recursive menus (e.g., "321-321-1234,,,1234#,,123344#....)
Submitted by
Jason
1
Changes Log Tag verify for Languages Code sub-versioning
Created
·
2025-12-18 10:41
Flavor
·
PCRE2 (PHP)
Search for the occurence of the 3 following words: CHA, LOG and TAG. Should be in the above order sequence (but it also if works swapped).
Submitted by
XrosaXasorX
1
Asw
Created
·
2025-12-17 05:38
Flavor
·
PCRE (Legacy)
``/^(?P0|1-9]\d)\.(?P0|[1-9]\d)\.(?P0|[1-9]\d)(?:-(?P(?:0|[1-9]\d|\d[a-zA-Z-)(?:\.(?:0|1-9]\d|\d[a-zA-Z-))))?(?:\+(?P[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/gmsAD
Submitted by
anonymous
1
DoubleQuote Enclosed CSV Field with Escaped DoubleQuote
Created
·
2025-12-11 12:04
Flavor
·
PCRE2 (PHP)
Extract field value of DoubleQuote Enclosed CSV Field with Escaped DoubleQuote The matching field value still contains escaped double quotes to be later processed :-)
Submitted by
Alper YAZGAN
1
test
Created
·
2025-12-09 04:53
Flavor
·
PCRE2 (PHP)
test
Submitted by
anonymous
1
Text in between HTML tags and inside quotation marks within HTML tags
Created
·
2025-12-08 04:32
Flavor
·
ECMAScript (JavaScript)
Overview This Regular Expression shows any text between HTML tags or between quotation marks within the tags themselves. An example would be: <HTML lang="en", then selecting the 'en' from there. Group 1 is between tags, and group 2 is in the quotes. I recommend only using half of this regular expression, like the 'between tags' part, or the 'inside quotes part'. Explanation The whole regex is built of two alternates, the tags and quotes part. The tags part (the first part) starts with a lookbehind of a closing of a tag, then a lazy part that selects almost characters, and a lookahead that checks for the beginning of tag (so the text is between tags). The quotes part is built in a similar structure, where it looks behind for an open of a tag, .+ , then checking for an equals sign followed by a quotation mark. The middle section of the quotes part is again just searching for text, but also not including quotation marks. The lookahead checks for a closing quotation mark and that's it! Please comment any questions or email me.
Submitted by
daniel@sabian.pro
1
Deucesanother
Created
·
2025-12-05 06:18
Flavor
·
PCRE (Legacy)
Fixwithpecra
Submitted by
Deuces9ers
1
001
Created
·
2025-12-04 05:41
Flavor
·
PCRE2 (PHP)
for Problem 2 - Fancy Barcodes
Submitted by
anonymous
1
Regex for MusicBrainz Picard Plugin – Title Cleaner OST
Created
·
2025-11-28 16:26
Updated
·
2025-11-28 16:26
Flavor
·
Python
One of the regular expressions I use for my plugin Title Cleaner OST.
Submitted by
nrth3rnlb
1
souly2
Created
·
2025-11-26 11:03
Flavor
·
PCRE2 (PHP)
import React, { useState } from 'react'; // Example characters array as props for demonstration const charactersData = [ { name: 'Gandalf', isWizard: true }, { name: 'Harry', isWizard: true }, { name: 'Aragorn', isWizard: false } ]; // in der Component CharacterList function CharacterList({ characters }) { const [showOnlyWizards, setShowOnlyWizards] = useState(false); function handleFilterClick() { setShowOnlyWizards(!showOnlyWizards); } let visibleCharacters; if (showOnlyWizards) { visibleCharacters = characters.filter(function(character) { return character.isWizard === true; }); } else { visibleCharacters = characters; } return ( {showOnlyWizards ? 'Alle anzeigen' : 'Nur Zauberer anzeigen'} {visibleCharacters.map(function(character) { return {character.name}; })} ); } // in App.jsx export default function App() { return ; }
Submitted by
anonymous
1
souly
Created
·
2025-11-26 10:52
Flavor
·
PCRE2 (PHP)
für julian <3
Submitted by
anonymous
1
zweckfreibaum
Created
·
2025-11-26 07:04
Flavor
·
PCRE2 (PHP)
d
Submitted by
anonymous
1
zweckfreibaum08
Created
·
2025-11-25 18:36
Flavor
·
PCRE2 (PHP)
08
Submitted by
anonymous
Community Library Entry
0
Regular Expression
Created
·
2022-11-23 18:30
Flavor
·
PCRE2 (PHP)
/
(
\(
\d
{1,3}
[
0
-
9,a
-
z,A
-
Z
]
{1}?
\)
(?<upc>
[
\d
,a
-
z,A
-
Z
]
{1,70}
)
)(
\(
\d
{1,3}
[
0
-
9,a
-
z,A
-
Z
]
{1}?
\)
(?<date>
[
\d
,a
-
z,A
-
Z
]
{1,70}
)
)(
\(
\d
{1,3}
[
0
-
9,a
-
z,A
-
Z
]
{1}?
\)
(?<batch>
[
\d
,a
-
z,A
-
Z
]
{1,70}
)
)
/
gm
Open regex in editor
Description
Parse the 3 groups of a GS1-128 Barcode
Submitted by
Mike D