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
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
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
Keep Talking and Nobody Explodes - Passwords
Created
·
2025-07-18 05:15
Flavor
·
Rust
See the chapter On the Subject of Passwords in Bomb Defusal Manual
Submitted by
prprnya
1
1
Created
·
2025-07-09 00:30
Updated
·
2025-07-09 00:33
Flavor
·
Golang
https://regex101.com/r/hIak43/1
Submitted by
1
1
Alpha
Created
·
2025-06-08 16:09
Flavor
·
Golang
W alpha/
Submitted by
Furkan
1
ip with port
Created
·
2025-02-16 23:19
Flavor
·
Golang
Parse the typical connection string address like 123.123.123.123:123, supports the correct port and octet range
Submitted by
anonymous
2
Discord IP Blocker
Created
·
2025-01-24 23:48
Updated
·
2025-01-24 23:56
Flavor
·
Rust
Blocks IPs that are sent in discord. Will block any IP, even if the numbers aren't in valid ranges (like 327.19.8.79) Has basic protections against whitespace
Submitted by
Bee3D
2
Discord emoji & Markdown links
Created
·
2024-12-14 18:33
Updated
·
2024-12-14 18:36
Flavor
·
Rust
NOTE The word text is used to substitute all alphanumeric characters as well as underscores (a-zA-Z0-9_]). Captures: [x] [text (the text in the parentheses doesn't get scanned) x] [text x] :text: Doesn't capture: [ ] [ ] [text] [ ] [text ] [ text ] [ text [ ] : text: [ ] :text : [ ] : text :
Submitted by
anonymous
1
advent of code 2024 day3
Created
·
2024-12-04 02:37
Updated
·
2024-12-05 03:15
Flavor
·
Golang
regex of challenge
Submitted by
Marcell Martini
1
AOC 2024 D3 regex
Created
·
2024-12-03 11:28
Flavor
·
Rust
The regex to be used in both parts of adventofcode.com 2024 day 3 puzzle
Submitted by
dragmine149
1
Validate a comma separated list of IPv4 addresses, CIDRs, or IPv4 Ranges like 1.1.1.1-1.1.1.10
Created
·
2024-11-03 21:59
Flavor
·
Golang
Simple Regex to *validate * (no extraction!) an IPv4 Range which can be a comma separated mixture of IPv4 addresses IPv4 CIDRs IPv4 Ranges like 1.1.1.1-1.1.1.10 Examples : 192.168.1.1,255.255.255.255/32,10.10.10.10/24,0.0.0.0/24 192.168.1.1/32 192.168.1.1 192.168.1.1/32 192.168.1.1/12 192.168.1.1/24 192.168.1.1/24 192.168.1.1/0,192.168.1.1/0 10.0.0.0/24 172.16.0.1-172.16.0.255 192.168.1.1,10.0.0.1/24,172.16.0.1-172.16.0.10 64.33.232.212 64.33.232.210/24
Submitted by
alucab
1
ISO 8601 DURATION - Terraform Validation
Created
·
2024-10-10 22:19
Flavor
·
Golang
This is made to validate an ISO 8601 input in a Terraform variable validation block: validation { condition = can(regex("^P(\\d+Y)?(\\d+M)?(\\d+D)?(T(\\d+H)?(\\d+M)?(\\d+S)?)?$", var.value)) error_message = "The value must be a valid ISO 8601 duration string representing time. (e.g. PT1M, PT1H30M, PT30S, etc.)" }
Submitted by
anonymous
1
Slash Separated Numbers
Created
·
2024-10-08 18:12
Flavor
·
Golang
...
Submitted by
Anonymous
1
Split Docker image into image name, tag and digest with all optional
Created
·
2024-08-27 08:22
Flavor
·
Golang
Splits a Docker image string into the separate parts: image, tag, digest tag and digest are optional
Submitted by
Roemer
1
Discord Server Invite, Rust RegEx
Created
·
2024-06-26 07:33
Flavor
·
Rust
A regular expression for Rust that matches against Discord server invite URLs, but not those without an actual code present. This may be used in Discord's AutoMod feature as it supports up to 10 Rust regular expressions per custom rule.
Submitted by
sepruko
1
JS/TS imports of external dependencies
Created
·
2024-06-25 08:26
Flavor
·
Rust
This regex can be used on a JavaScript/TypeScript file to find imports from third-party packages. This is useful for determining what to put in dependencies/peerDependencies. This is a Rust regex, which makes it easy to use with rg (ripgrep). Pro tip: combine rg with sort -u to get a list of all packages for your JS/TS project! Based on a similar PCE2 regex
Submitted by
Nikita Karamov
1
"fake" markdown link detection
Created
·
2024-04-25 18:42
Updated
·
2024-04-26 18:15
Flavor
·
Rust
This regex catches markdown links where the display text is also a link, like this: \example.com in order to prevent people getting tricked and clicking on a link that isn't what it says it is. See the test string for a much longer explanation with examples.
Submitted by
Osh
2
Discord Anti-Advertisement 2
Created
·
2023-12-18 13:25
Updated
·
2024-01-23 15:38
Flavor
·
Rust
Pair this with my Discord AutoMod Anti Advertisement for full protection against invites. Use this with Discord's Built In AutoMod.
Submitted by
dogknife
2
Discord Anti Advertisement
Created
·
2023-12-17 20:34
Updated
·
2024-01-23 17:37
Flavor
·
Rust
Discord AutoMod Regex Use this Regex with Discord's built-in automod to prevent all invite URLs. This will block discord.gg/ad but not .gg/ad Consider seeing my "strict" version otherwise.
Submitted by
dogknife
2
Discord AutoMod Advert (Strict)
Created
·
2023-12-17 01:36
Updated
·
2024-01-23 17:37
Flavor
·
Rust
Use this with Discord automod. Bear in mind, this is "Strict" because it will block discord.gg/myad AND other links such as dsc.gg/myad
Submitted by
dogknife
1
Rust type-like ident casing
Created
·
2023-11-04 19:35
Flavor
·
Rust
Matches built-in primitives and identifiers with casing conventionally used for type/constant names.
Submitted by
Neel Yadav
1
Kafka loki parser
Created
·
2023-10-24 21:34
Flavor
·
Golang
Kafka loki parser
Submitted by
anonymous
2
Rust Phone Number
Created
·
2023-10-23 21:47
Flavor
·
Rust
not fully featured, but simple.
Submitted by
Jakersnell
1
0x28C6A6DdF8fF8A47A90A69bfE75cd89904a14d71
Created
·
2023-09-02 02:02
Flavor
·
Golang
0x28C6A6DdF8fF8A47A90A69bfE75cd89904a14d71
Submitted by
anonymous
2
Mikrotik firewall logs
Created
·
2023-08-11 19:09
Updated
·
2023-08-11 21:09
Flavor
·
Golang
Matching for mikrotik ROS 7 Used in promtail and grafana
Submitted by
anonymous
0
Catch packages from 'tdnf list' output
Created
·
2023-06-26 18:42
Flavor
·
Golang
Every valid line will be of the form: . . . NOTE: the distribution tag is expected to start with at least one letter and be followed by at least one digit.
Submitted by
anonymous
-2
rustyms: pro forma single modification
Created
·
2023-06-21 21:59
Flavor
·
Rust
The regex to match a single pro forma modification with all its intricacies.
Submitted by
Douwe Schulte
1
Prometheus Exposition metric line
Created
·
2023-05-30 09:41
Flavor
·
Rust
Prometheus exposition metric line format. Parses metric lines with named capture groups for metric name, labels, value, and timestamp. Excludes comment, type, and help lines. https://prometheus.io/docs/instrumenting/exposition_formats/#line-format
Submitted by
james-jra
0
Unicode Hexadecimal
Created
·
2023-05-17 21:24
Updated
·
2023-05-17 21:52
Flavor
·
Rust
Find hexadecimal numbers using Extended Unicode Support.
Submitted by
anonymous
1
Home
Created
·
2023-05-13 08:42
Flavor
·
Golang
Dj dus er geen je een je aan je enige eerst een he we er
Submitted by
Webmaster
1
extract <*n or <n where n is a number
Created
·
2023-05-11 14:37
Flavor
·
Golang
see https://stackoverflow.com/questions/76228402/regex-to-extract-n-where-n-is-digit
Submitted by
code_monk
1
Authelia regex path rules
Created
·
2023-05-06 19:29
Updated
·
2023-05-07 13:35
Flavor
·
Golang
Testing Authelia subdomain / path rules. You can read more at the Authelia Docs By default, this regex101 page is shown a test for a generic API path domain: "some-sub.drpranavmishra.com" resources: "^/api([/?].*)?$" # API paths "^/healthz.*$" # Health check "^/\?[\S]{40,70}$" # PrivateBin policy: bypass`
Submitted by
Pranav Mishra
0
Get digits
Created
·
2023-05-03 18:20
Flavor
·
Golang
Trying to get digits
Submitted by
Arthur Silva
0
walter1976LastClean
Created
·
2023-05-02 03:52
Flavor
·
Golang
walter1976LastClean
Submitted by
anonymous
1
Get python function declaration
Created
·
2023-05-01 17:57
Flavor
·
Rust
Gets the python function declarations
Submitted by
anonymous
0
匹配限定后缀名的文件,忽略大小写
Created
·
2023-04-26 14:47
Flavor
·
Golang
匹配.mka后缀名的文件,忽略大小写
Submitted by
anonymous
0
匹配限定后缀名中的指定关键字,忽略大小写
Created
·
2023-04-26 14:31
Updated
·
2023-04-26 14:38
Flavor
·
Golang
匹配.mkv和.mp4后缀名中包含menu或sp或.sample,忽略大小写
Submitted by
anonymous
2
golang re2 negative lookahead
Created
·
2023-04-21 10:28
Flavor
·
Golang
Aquivalent solution for golang's unsupported negative lookahead in re2 flavor of go's regex. This example provides a negative lookahead similar to (?!/api/) ignoring routes with the /api/ prefix at the start.
Submitted by
misha
0
pxc plcnext
Created
·
2023-03-27 07:38
Flavor
·
Golang
plcnext version strings
Submitted by
anonymous
0
domain
Created
·
2023-03-12 10:30
Flavor
·
Golang
ss
Submitted by
sssssss
0
Semver split
Created
·
2023-03-10 10:10
Flavor
·
Golang
"1.2.3" Group 1: 1 Group 2: 2 Group 3: 3
Submitted by
Icaruk
0
Kt SDK V2
Created
·
2023-02-13 15:50
Updated
·
2023-02-14 14:37
Flavor
·
Golang
kt SDKV2
Submitted by
anonymous
0
GO SDK V2
Created
·
2023-02-13 14:23
Updated
·
2023-02-14 14:22
Flavor
·
Golang
Go SDK v2
Submitted by
anonymous
0
REACT SDK V3
Created
·
2023-02-13 10:15
Flavor
·
Golang
React SDK V3
Submitted by
anonymous
0
Anime Xdcc Name + Episode Regex
Created
·
2023-02-11 04:28
Flavor
·
Golang
Parse XDCC filename strings for a name and episode. Appears to work for most major bots but unreliable for any data other than name and episode number/version
Submitted by
anonymous
0
log timestamp
Created
·
2023-01-30 15:42
Flavor
·
Golang
extract time stamp from log entry
Submitted by
anonymous
0
RE2 match of APRS-IS header information
Created
·
2023-01-07 18:33
Flavor
·
Golang
This re2 (using Go in my case) matches the APRS-IS header. The format of the APRS-IS packet is TNC2 standard: SOURCE>DESTINATION,PATH:PACKET This regex matches the Q construct format used by APRS-IS: `SOURCE>DESTINATION,PATH,QCON,FROMCALL: The result is a series of capturable groups: Group 1: Src SSID Group 2: Dest SSID Group 3: Path Group 4: Q construct Group 5: From Calll
Submitted by
Jack Hamm (jack@wv6l.net)
0
Golang Get variables In Js
Created
·
2023-01-06 18:06
Flavor
·
Golang
To get
Submitted by
anonymous
0
Date String ISO Pattern
Created
·
2022-12-19 15:16
Flavor
·
Golang
Date String ISO Pattern matcher
Submitted by
Lucas Morais
0
VLAN ID Validation Regex
Created
·
2022-12-09 13:32
Flavor
·
Golang
VLAN ID Validation Regex Please use first segment or second depending on the Extended VLAN usage such as "1-256" or "1-4096" : Non-extended VLAN IDs (1-256), check v2 of the regex entry ^(25[0-6]|(2[0-4]|1\d|[1-9])\d|[1-9])$ Extended VLAN IDs (1-4096), check v3 of the regex entry ^(409[0-6]|(40[0-8]|[1-3]\d\d|[1-9]\d|[1-9])\d|[1-9])$
Submitted by
ulgena
Load More
Community Library Entry
33
Regular Expression
Created
·
2015-01-23 16:47
Updated
·
2023-07-19 08:36
Flavor
·
PCRE (Legacy)
/
(?(DEFINE)
(?P<ver>
\d
+
(?:
\.
\d
+
)*(?!
[
.
\d
]
)
)
(?P<agent>
Mozilla
\/
(?&ver)
)
(?P<os>
(?&os_windows)
|
(?&os_linux)
|
(?&os_macintosh)
|
(?&os_ios)
)
(?P<os_windows>
Windows
[
]
\w
+
[
]
(?&ver)
)
(?P<os_linux>
Linux
(?:
[
]
(?:
i686
|
x86_64
)
)?
)
(?P<os_macintosh>
Macintosh
)
(?P<os_ios>
(?:
CPU
[
]
)?
iPhone
[
]
OS
|
CPU
[
]
OS
.
*?
like
[
]
Mac
[
]
OS
[
]
X
)
(?P<device>
(?&device_ios)
|
(?&device_firefox)
|
(?&device_android)
)
(?P<device_ios>
iPhone
|
iPad
)
(?P<device_firefox>
Mobile
)
(?P<device_android>
Android
(?:
[
]
(?&ver)
)?
)
(?P<browser>
(?:
(?&browser_ie)
|
(?&browser_safari)
|
(?&browser_chrome)
|
(?&browser_chromium)
|
(?&browser_firefox)
|
(?&browser_version)
#
|
(?&browser_nexus)
|
(?&browser_mobile)
|
(?&browser_gsa)
|
(?&browser_quicklook)
|
(?&browser_opera)
)
[
\/
]
(?:
[
A
-
Z
\d
]
+
\b
(?!
\.
)
|
(?&ver)
)
)
(?P<browser_safari>
(?:
Mobile
[
]
)?
Safari
)
(?P<browser_chrome>
Chrome
)
(?P<browser_chromium>
\b\w
+
\b
[
]
Chromium
)
(?P<browser_firefox>
Firefox
)
(?P<browser_ie>
MSIE
)
(?P<browser_version>
Version
)
(?P<browser_nexus>
Nexus
[
]
\d
+
[
]
Build
)
(?P<browser_mobile>
Mobile
)
(?P<browser_gsa>
GSA
)
(?P<browser_quicklook>
QuickLook
)
(?P<browser_opera>
OPR
)
)
^
(?:
(?=
.
*?
(?P<Agent>
(?&agent)
)
)
)
(?:
(?=
.
*?
(?P<OS>
(?&os)
)
)
)
(?:
(?=
.
*?
(?P<Device>
(?&device)
)
)
)?
(?:
(?=
.
*?
(?P<Browser>
(?&browser)
(?:
[
]
(?&browser)
)*
)
)
)?
/
gmx
Open regex in editor
Description
From a (fairly large) list of User Agent strings, extract the OS, Browser, and Device Type.
Submitted by
OnlineCop