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
3
Extract URL parts only named capturing groups
Created
·
2022-02-03 00:00
Flavor
·
Golang
Extract URL parts only named capturing groups
Submitted by
dixanms
3
Hostname validation
Created
·
2017-01-29 01:16
Flavor
·
Golang
Validates subdomain, root domain, and wild card domains
Submitted by
AnonymousDapper
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
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
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
2
Rust Phone Number
Created
·
2023-10-23 21:47
Flavor
·
Rust
not fully featured, but simple.
Submitted by
Jakersnell
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
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
2
domain for Google Data Studio (re2 dialect)
Created
·
2016-12-12 04:12
Flavor
·
Golang
Matches subdomain, domain and top level in a field that contains a urls. https://www.whatever.you.want ---> whatever.you.want
Submitted by
anonymous
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
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
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
1
0x28C6A6DdF8fF8A47A90A69bfE75cd89904a14d71
Created
·
2023-09-02 02:02
Flavor
·
Golang
0x28C6A6DdF8fF8A47A90A69bfE75cd89904a14d71
Submitted by
anonymous
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
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
1
Get python function declaration
Created
·
2023-05-01 17:57
Flavor
·
Rust
Gets the python function declarations
Submitted by
anonymous
1
Get project name from git url
Created
·
2022-09-26 13:58
Flavor
·
Golang
Used by Zarf to obtain the name of a repository when given a git URL.
Submitted by
Jonathan Perry
1
1
Created
·
2022-08-26 15:36
Flavor
·
Golang
11
Submitted by
anonymous
1
nginx access regex loki
Created
·
2022-07-28 11:51
Flavor
·
Golang
nginx access log regex
Submitted by
Lethisa Putri
1
Parse Kubernetes Resource URI Paths
Created
·
2021-11-05 05:52
Flavor
·
Golang
This regex extracts Kubernetes Resource URIs. Copyright 2021 Mathew Wicks Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Submitted by
Mathew Wicks
1
SQL comments Big Query
Created
·
2021-09-23 15:19
Flavor
·
Golang
SQL comments on Big Query
Submitted by
anonymous
1
yyyy/mm/dd
Created
·
2021-08-25 12:44
Flavor
·
Golang
^(((\d{3}1-9]|\d{2}[1-9]\d|\d[1-9]\d{2}|[1-9]\d{3})(\/)(((0[13578]|1[02])(\/)(0[1-9]|[12]\d|3[01]))|((0[469]|11)(\/)(0[1-9]|[12]\d|30))|(02(\/)(0[1-9]|[1]\d|2[0-8]))))|(((\d{2})(0[48]|[2468|13579)|((048]|[2468|3579)00))(\/)02(\/)29))$ Match year/month/day format. e.g: 2020/02/29 [match] 2021/02/29 [mismatch] 2021/08/25 [match]
Submitted by
mayl0421
1
lsblk-output-regex
Created
·
2021-08-18 18:00
Flavor
·
Golang
Trying to adapt this regex to support LVM.
Submitted by
anonymous
1
Traefik - MDW to add slash
Created
·
2021-07-06 15:20
Flavor
·
Golang
Used in Traefik to add slash
Submitted by
juranir.santos@gmail.com
1
utf-8 char in imap mail
Created
·
2021-06-23 16:05
Flavor
·
Golang
Check golang for presence of utf-8 char in rawEmail e.g. ?= =?UTF-8?Q? or =?3D?UTF-8?Q?
Submitted by
oscarunix
1
Valid email regexp in Go
Created
·
2021-06-22 11:02
Flavor
·
Golang
A regexp to validate an email address according to https://html.spec.whatwg.org/#valid-e-mail-address . Note that the backslash in the name part of the regexp on that site is there to escape the forward slash, which is not needed in Go.
Submitted by
markus@maragu.dk
1
^(?:\d+[a-z]|[a-z])(?:\^\d+)(?:[\+|\-])(?:\d+[a-z])(?:[\+|\-])(?:\d+\=\d+)
Created
·
2021-01-14 02:14
Flavor
·
Golang
for quadratic equations ||ax^2+bx+c=d||
Submitted by
anonymous
1
Unix file with full path
Created
·
2020-08-10 22:34
Flavor
·
Golang
Find all string matches with dir, one or more subdir, file name with optional extension. Common example with all capturing groups included: ../../dir/SubDir1/SubDir2/file.ext Note that Full path can begins with ./ or / patterns.
Submitted by
anonymous
1
windows file name from full path
Created
·
2020-08-10 22:29
Flavor
·
Golang
Find all string matches with dir, one or more subdir, file name with optional extension. Common example with all capturing groups included: C://ProgramFiles/MyDir1/myDir2/file.ext
Submitted by
anonymous
1
Lxx Wurzel
Created
·
2020-08-07 05:44
Flavor
·
Golang
no description available
Submitted by
anonymous
1
Flexible box
Created
·
2020-07-30 16:31
Flavor
·
Golang
no description available
Submitted by
anonymous
1
Traefik stripprefixregex for web apps
Created
·
2020-07-17 12:03
Flavor
·
Golang
Notes: Do not forget to escape the $ by an additional $. Escaping ? like \? does not work. But you could use [?] instead End result should be like this: "traefik.http.middlewares.r6tt-dev-web.stripprefixregex.regex=^/[a-z0-9/]+[a-z0-9]+([?]+.*)?$$"
Submitted by
anonymous
Load More
Community Library Entry
0
Regular Expression
Created
·
2021-03-11 16:55
Flavor
·
Golang
`
^
<
[
0
-
9
]
+
>
(?:
[
A
-
Z
][
a
-
z
]
{2}
\s
+
[
0
-
9
]
{1,2}
\s
[
0
-
9
]
{1,2}
:
[
0
-
9
]
{2}
:
[
0
-
9
]
{2}
)
\s
+
(?:
[^
\s
]
+
)
\s
+
(?:
[^
\s
]
+
)
\s
+
(?P<Timestamp>
[
0
-
9
]
+
)
\|
(?P<TraceID>
[^
|
]
+
)
\|
(?P<Unknown>
[^
|
]
+
)
\|
(?P<RemoteAddress>
[^
|
]
+
)
\|
(?P<Username>
[^
|
\s
]
+
)
\|
(?P<RequestMethod>
[
GETPOSUDLACH
]
+
)
\|
(?P<RequestURL>
[^
|
]
+
)
\|
(?P<RequestUserAgent>
[^
|
]
+
)
\|
(?P<ResponseStatusCode>
[
0
-
9
]
{3,}
)
\|
(?P<RequestDuration>
[
0
-
9
]
+
)
$
`
mg
Open regex in editor
Description
no description available
Submitted by
Scott Barnes