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
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
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
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
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
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 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
1
IPv4 private CIDR range RFC1918
Created
·
2020-01-20 10:24
Flavor
·
Golang
Validates that you provide a CIDR in one of the following valid ranges. 0.0.0 – 127.255.255.255 127.0.0.0/8 0.0.0 – 10.255.255.255 10.0.0.0/8 16.0.0 – 172. 31.255.255 172.16.0.0/12 192.168.0.0 – 192.168.255.255 192.168.0.0/16 Subnets can be smaller (e.g. 192.168.0.0/17 is valid) but not larger (e.g. 192.168.0.0/15 is invalid). Single hosts (i.e. /32s) are invalid. Host bits are generally ignored (i.e. 192.168.1.2/16 is considered valid)
Submitted by
David Stockton
1
Extract columns names from any select query
Created
·
2018-06-28 19:25
Flavor
·
Golang
This regex can capture any column name from a select query. Be the original name, like are named on table, renamed with a reserved word AS or even without explicit AS. Go on, and test with your query ;)
Submitted by
Jefferson Gouveia
1
Domain validation regex suitable for user input
Created
·
2020-03-22 22:40
Flavor
·
Golang
This regexp can be used to validate domain names in Golang. While it cannot enforce the 253 character limit (with optional trailing period not included) that can be easily done by a simple len(domain) <= 253 check as well. This can be used as-is in other languages, even with RE2 regex engine. If positive lookbehind assertions are available, the character limit can be used. Non-capturing groups are used. Example validated domains (some may be invalid per TLD rules): example.com _25._tcp.SRV.example punycoded-idna.xn--zckzah under_score.example Example invalid domains: 192.0.2.1 has spaces.com easy,typo.example domain\.escapes.invalid no_trailing_.invalid -leading-or-trailing-.hyphens.invalid TLDs have more validation, the following will not validate: example digit.1example underscore._example_com but with a trailing period, the same rules as non-TLD are applied: example. 192.0.2.1. digit.1example. underscore._example_com.
Submitted by
Alexander Dupuy
1
Siebel Id
Created
·
2016-11-03 10:39
Flavor
·
Golang
no description available
Submitted by
anonymous
1
get video id from youtube link
Created
·
2016-01-23 20:19
Updated
·
2023-07-24 18:14
Flavor
·
Golang
no description available
Submitted by
RyuaNerin
0
FB payload
Created
·
2020-01-09 13:46
Flavor
·
Golang
no description available
Submitted by
anonymous
-1
rtrtr
Created
·
2021-05-26 15:21
Flavor
·
Golang
gtgtg
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
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
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
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
Community Library Entry
0
Regular Expression
Created
·
2020-05-29 09:17
Flavor
·
PCRE (Legacy)
/
^
[
A
-
Z
]
{2}
[
0
-
9
]
{8}
[
A
-
Z#
]
{10}
$
/
gm
Open regex in editor
Description
RJ provided CONCAT code
Submitted by
anonymous