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
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
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
Deucesanother
Created
·
2025-12-05 06:18
Flavor
·
PCRE (Legacy)
Fixwithpecra
Submitted by
Deuces9ers
1
普罗米修斯解析匹配
Created
·
2025-09-27 07:04
Flavor
·
Java
"^([\w_]+)(?:\{(*)\})?\s+([\d\\.e+-]+)(?:\s+(\d+))?$"gm
Submitted by
umanan
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
Tag
Created
·
2025-07-04 07:14
Flavor
·
PCRE (Legacy)
Submitted by
anonymous
1
Alpha
Created
·
2025-06-08 16:09
Flavor
·
Golang
W alpha/
Submitted by
Furkan
1
Deucereadthedocs
Created
·
2025-05-29 16:09
Flavor
·
PCRE (Legacy)
Deuce read the docs then regexed
Submitted by
anonymous
1
unityourighumanity
Created
·
2025-04-01 06:30
Flavor
·
PCRE (Legacy)
minal aidzin wal Faidzin
Submitted by
anonymous
1
OpenSearch + ElasticSearch minimum_should_match pattern
Created
·
2025-03-13 10:17
Flavor
·
Java
Validation pattern to validate the minimum_should_mach value in opensearch and elasticsearch queries. For more information on the minimum_should_match field have a look here for opensearch or here for elasticsearch
Submitted by
Hackante
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
regex
Created
·
2025-01-19 04:30
Flavor
·
PCRE (Legacy)
Match regex cheat sheet words in https://techearl.com/regex-cheat-sheet url
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
Parse Cabrillo Amateur Radio Contest QSO line (CQWW - Zone Exchange)
Created
·
2024-12-03 15:16
Updated
·
2024-12-03 15:20
Flavor
·
PCRE (Legacy)
Parses the QSO line of the Amateur radio contest log file format called Cabrillo. This handles the CQ World-wide contest exchange format of RS[T] and a zone. It would be a starting point for other exchanges like ARRl Field Day or another one with spaces in the exchange. This does handle either a QSO: tag or an X-QSO: tag for deleted X-QSO entries.
Submitted by
NY4I
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
vozuskia (cs/sk)
Created
·
2024-09-12 15:35
Flavor
·
Java
Addes a non-breaking space after any of the letters included in the [vozuskia] class.
Submitted by
Manuel Souto Pico
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
3
**japanese text** to bold <b>japanese text</b>
Created
·
2024-08-18 18:02
Updated
·
2024-08-18 18:03
Flavor
·
PCRE (Legacy)
japanese text to bold japanese text 食べるんだ 食べるんだ
Submitted by
kurokuroshii
1
RFC3339 Validator
Created
·
2024-08-13 08:52
Updated
·
2024-08-13 08:52
Flavor
·
PCRE (Legacy)
RFC3339 Validator
Submitted by
anonymous
1
Automod - Discord scam invitations
Created
·
2024-06-24 01:01
Flavor
·
PCRE (Legacy)
Matches variations of messages commonly used to send Discord scams/hacks. Instructions are written for YAGPDB
Submitted by
paiuxfluens
1
YouTube Video ID
Created
·
2024-05-20 13:58
Flavor
·
Java
Gets the ID of a YouTube Video from any link to it.
Submitted by
cheeseburger
1
indented lines with continuation
Created
·
2024-05-04 05:48
Flavor
·
PCRE (Legacy)
Example taken from SO,
Submitted by
anonymous
1
Renamer Log file to CSV
Created
·
2024-04-13 14:26
Flavor
·
PCRE (Legacy)
Catches our log files renamed file names and adds them to CSV file
Submitted by
anonymous
1
Parse Address - Prefecture
Created
·
2024-03-20 03:46
Flavor
·
Java
get prefecture from Japanese address
Submitted by
Gary Ascuy
1
AWS EventBridge Scheduling Expressions
Created
·
2024-03-13 19:19
Updated
·
2024-04-25 23:00
Flavor
·
Java
This validates AWS EventBridge scheduling expressions using the rate() and cron() formats. It may not catch all invalid expressions, but it should properly validate all valid expressions, as demonstrated in the unit tests. Please let me know if I missed any valid expressions. Originally attempted this using named capture groups and named back-references to reduce duplication. Unfortunately, named capture support is tricky, so they were all converted to duplicated non-capturing groups instead.
Submitted by
Evan S Kaufman <evan@evanskaufman.com>
1
IANA Media Type
Created
·
2024-02-22 19:45
Flavor
·
Java
Parses an IANA Media Type value. Doesn't seem to capture repeating parameters, which is a bit of an edge case but valid I think - any suggestions on how to fix would be appreciated.
Submitted by
scottbdr
1
Detect Multiple File Extensions
Created
·
2024-02-17 03:00
Updated
·
2024-02-17 03:06
Flavor
·
PCRE (Legacy)
I use this to find files with two or more extensions (i.e. file.txt.txt). This will work with files with 3 or 4 character or numeric (or both) file extensions (i.e. pdf, xlsx).
Submitted by
Curve
1
Chinese Digits
Created
·
2024-01-05 07:56
Updated
·
2024-02-06 07:02
Flavor
·
PCRE (Legacy)
Match Chinese Digits less than 1×10^16, such as “一千两百三十四万”、“八萬点七六五”、“玖仟玖佰玖拾玖万玖仟玖佰玖拾玖亿玖仟玖佰玖拾玖万玖仟玖佰玖拾玖点玖玖玖玖玖玖玖玖玖玖玖玖玖玖玖玖”,Upper and lower case Chinese can be mixed, but Chinese numbers and English numbers cannot be mixed. Illegal numbers will not be matched. For example: “两十六” will not be matched, as the correct one should be “二十六”,In general Chinese, “两” and “十” are not used together; “两千零零六” will not be matched, as the correct one should be “两千零六”,as consecutive "零" in the integer part of Chinese numbers are illegal. It need a regex engine that supports the functionality of matching an expression defined in a named capture group, such as "(?[a-z]+)\d+(&letter)". 用于匹配小于1×10^16的中文数字,例如:“一千两百三十四万”、“八萬点七六五”、“玖仟玖佰玖拾玖万玖仟玖佰玖拾玖亿玖仟玖佰玖拾玖万玖仟玖佰玖拾玖点玖玖玖玖玖玖玖玖玖玖玖玖玖玖玖玖”,大小写中文数字可以混用,中文数字与英文数字不可以混用。 不合法的中文数字不会被匹配,例如:“两十六”、“两十六万”不会被匹配,因为中文习惯中不将“两”与“十”连用;“两千零零六”不会被匹配,因为其中有连续的零。 需要引擎支持引用已定义组的表达式,例如:"(?[a-z]+)\d+(&letter)"。
Submitted by
anonymous
1
NPC名称匹配
Created
·
2023-12-25 00:26
Flavor
·
PCRE (Legacy)
^\h{4}段首4个横向空格 +不包含左括号、换行符号的其他字符,1~无限循环 \((.*)\)$捕获处于()之中的任意字符内容,右括号在段尾
Submitted by
vicrly
1
文件名称验证
Created
·
2023-12-01 16:03
Flavor
·
Java
操作系统文件名称验证,参考了Windows,Linux,Mac
Submitted by
腾龙问天
1
verifyIPV6
Created
·
2023-11-20 15:18
Flavor
·
Java
verificare indirizzo IPV6 (regole base)
Submitted by
Luigi Piccinni
2
Check Email Validity
Created
·
2023-11-15 10:54
Updated
·
2023-11-15 17:35
Flavor
·
Java
Regular expression to check the email syntax validity. Certainly requires improvement, but it's a good basis to work from. Work with Java and JavaScript.
Submitted by
Alain TOMASIAN <alain.tomasian@kaptus.fr>
1
Gradient for minecraft
Created
·
2023-11-14 09:00
Flavor
·
Java
This is for my plugin project
Submitted by
Trần Thế Anh
1
77870294
Created
·
2023-11-12 11:36
Updated
·
2023-11-12 11:39
Flavor
·
PCRE (Legacy)
618001/041881 564094
Submitted by
960203095053
1
Kafka loki parser
Created
·
2023-10-24 21:34
Flavor
·
Golang
Kafka loki parser
Submitted by
anonymous
1
Youtube Video ID
Created
·
2023-10-18 07:16
Updated
·
2023-10-26 14:06
Flavor
·
Java
Extract youtube video ID
Submitted by
anonymous
1
Extract text strings from repeating text fields followed by a suffix
Created
·
2023-09-22 11:56
Flavor
·
Java
This regex expression is useful for extracting only the text string from a value in a column that may contain values from individual rows with repeat strings tagged with a suffix. For example - Row 1: "Sales (#1)", Row 2: "Sales Match (#2)". From the shared examples, this regex will extract the text "Sales" and "Sales Match."
Submitted by
nilotpalc
1
groupping math every 2 comma separator
Created
·
2023-09-19 18:20
Flavor
·
PCRE (Legacy)
i have paste \n after every 2-th comma using sed sed 's/\(\(*,\)\{2\}\)/\1\n/g'
Submitted by
sanekmihailow
1
Remove specific parameter from URL
Created
·
2023-09-13 00:35
Updated
·
2023-09-13 00:41
Flavor
·
PCRE (Legacy)
This pattern finds a parameter (sst) key + value in a GET request URL. When replaced with an empty string, effectively removes the parameter. Works with both full URLs and isolated query strings. Works in PCRE and PCRE2. Full use case: if (isset($_GET["sst"])) { // validate // modify active session $query = $_SERVER["REQUEST_URI"]; $pattern = "/(sst=+&)|((\?|&|^)sst=+$)/"; $uri = preg_replace($pattern, "", $query); unset($_GET["sst"]); header("location: https://example.com$uri", true, 308); }
Submitted by
Martin Holt
2
CSV
Created
·
2023-09-09 10:06
Flavor
·
Java
Crude CSV regex to split only by characters surrounded by non-whitespace characters. Ignore that it dosen't highlight all of the other commas in the editor. If you select the g regex flag it will properly show here, but not work in Java. Credit to @merosity (Merosity#0135) on Discord!
Submitted by
Merosity, regice202
1
Opportunity Close
Created
·
2023-09-08 17:15
Flavor
·
PCRE (Legacy)
Prepare batch job for opportunity close
Submitted by
wistlo
1
Adds custom prefix to tailwind classes
Created
·
2023-09-04 10:51
Flavor
·
PCRE (Legacy)
Or any other particular case where given any line that starts with the pattern "@apply" (or any other line heading) and it substitutes any word (list of characters without spaces), with or without puntuation in them, and it adds a custom prefix to all the words in that line but the line heading.
Submitted by
@drakopablo.dev
2
Invalid Windows Filename Chars
Created
·
2023-09-04 05:47
Updated
·
2023-09-04 05:54
Flavor
·
PCRE (Legacy)
https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file Integer value zero, sometimes referred to as the ASCII NUL character. Characters whose integer representations are in the range from 1 through 31, except for alternate data streams where these characters are allowed. For more information about file streams, see File Streams. The following reserved characters: `` (greater than) : (colon) " (double quote) / (forward slash) \ (backslash) | (vertical bar or pipe) ? (question mark) * (asterisk)
Submitted by
anonymous
1
0x28C6A6DdF8fF8A47A90A69bfE75cd89904a14d71
Created
·
2023-09-02 02:02
Flavor
·
Golang
0x28C6A6DdF8fF8A47A90A69bfE75cd89904a14d71
Submitted by
anonymous
1
Match many cases of 8601
Created
·
2023-08-31 11:08
Updated
·
2023-08-31 14:32
Flavor
·
Java
This is still a working in progress Need to do Unit Tests and search for more use cases Match partial cases of 8601 such as: missing offset missing time only date and offset nano present or not (and being from 1 digit to 9 digits) Also properly captures the data by capturing only: year, month, date, hour, minute, second, nano and offset (be it 'Z' or '+02:00' or' +0200')
Submitted by
jpmand
Load More
Community Library Entry
0
Regular Expression
Created
·
2023-07-09 17:24
Flavor
·
Python
r"
(
```
|
`
)(
python
)?
\s
*?
\n
?
(
from
\S
+
)?
import
\S
+
(
\n.
*?
;
)*
\n
(
(
.
*
return
\S
+
```
)
|
(
`return
\S
+
`
)
)
"
gm
Open regex in editor
Description
A regex that matches comments that adhere to the rules of r/ProgrammerHumor
Submitted by
anonymous