Please enable JavaScript to use this web application.
Regular
Expressions
101
Social
Social
Join the Discord community!
Follow me on twitter!
Send me an email
Donate
Donate
Donate through Paypal
Become a Github Sponsor
Info
Info
Find out what's new!
RegEx101 Wiki
Report bugs or make suggestions
What's new?
Loading content...
Close
Regex Editor
Regex Editor
Community Patterns
Community Patterns
Account
Account
Regex Quiz
Regex Quiz
Settings
Settings
Live Help
Live Help
Get help on Discord
Get help on IRC
Order By
Most Recent
Highest Score
Lowest Score
Most upvotes
Most downvotes
Filter by Flavor
PCRE2 (PHP >=7.3)
PCRE (PHP <7.3)
ECMAScript (JavaScript)
Python
Golang
Java 8
.NET (C#)
Rust
Sponsors
Community Patterns
Search among 2,340 community submitted regex patterns...
10
12 upvotes, 2 downvotes (score 66.1%) (You must be signed in to vote)
Get path from any text
Recommended
This entry has been specifically selected by our team to be a great submission
PCRE2 (PHP >=7.3)
Get path (windows style) from any type of text (error message, e-mail corps ...), quoted or not. THIS IS THE SINGLE LINE VERSION !_ If you want understand how it work or edit it, go https://regex101.com/r/7o2fyy Relative path are not supported...
Submitted by
nitrateag
-
8 months ago
2023-01-31 14:38
(Last modified 2 months ago)
2023-07-23 20:17
4
4 upvotes, 0 downvotes (score 51%) (You must be signed in to vote)
CloudFlare
PCRE2 (PHP >=7.3)
Cloud Flare
Submitted by
anonymous
-
2 years ago
2021-06-29 16:27
4
4 upvotes, 0 downvotes (score 51%) (You must be signed in to vote)
Email
PCRE2 (PHP >=7.3)
email format control
Submitted by
ahmetbarut
-
2 years ago
2021-07-10 13:06
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
National Insurance Number regular expression
PCRE2 (PHP >=7.3)
This regular expression is build from the description of NINO number of GOV.UK,
Submitted by
Iftakhar Husan
-
3 years ago
2021-03-20 22:05
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
Livestock - Visual tag and Back tag
PCRE2 (PHP >=7.3)
Visual tag and Back tag cannot more than 15 characters or only can contain uppercase, lowercase, space and dash.
Submitted by
Adrian Yim
-
3 years ago
2021-03-26 17:11
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
camelCase2snake_case
PCRE2 (PHP >=7.3)
Convert camelCase to snake_case def camelCase2snake_case(txt): """ Convert camelCase to snake_case https://regex101.com/library/wUcSv4...
Submitted by
JV-conseil
-
6 months ago
2023-03-23 19:10
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
Discord ID:NAME#DISCRIM match
PCRE2 (PHP >=7.3)
For example, using `Carl-bot to dump members of the @everyone role ordering highest of id`: `!dump @everyone %i:%u -o id` Example of return: 498984530968051713:lanjt#2129 ......
Submitted by
lanjt
-
2 years ago
2021-07-06 00:24
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
example
PCRE2 (PHP >=7.3)
example
Submitted by
anonymous
-
2 years ago
2021-07-13 06:44
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
Match any url in text or html (http, https)
PCRE2 (PHP >=7.3)
Match any url in text or html (http, https)
Submitted by
Jérémy Munsch
-
2 years ago
2022-02-02 15:04
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
Extract URL parts only named capturing groups
Golang
Extract URL parts only named capturing groups
Submitted by
dixanms
-
2 years ago
2022-02-03 00:00
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Max 30 Characters excluding brackets
PCRE2 (PHP >=7.3)
This is a simple regex for 30 characters limit excluding brackets
Submitted by
jusuchin85
-
a year ago
2022-04-27 06:27
(Last modified a year ago)
2022-04-27 06:46
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Extract Rapidgator Links from a HTML web page (Works for rg.to and rapidgator.net)
PCRE2 (PHP >=7.3)
Click "open regex in editor" to open regex. Open a webpage containing Rapidgator Links - Either rg.to or rapidgator.net Right-click anywhere on the page and select "view page source" Copy the HTML markup containing the Rapidgator links to regex101.com Paste the HTML markup and set mode to match Loca...
Submitted by
SmartCoder
-
a year ago
2022-05-26 17:44
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Detect RGB/RGBA colors in CSS
PCRE2 (PHP >=7.3)
JS function to convert RGB(A) to HEX color for single values: /** @param {string} color the RGB(A) color @return {string} the HEX color */ function rgba2hex(color)...
Submitted by
WinterSilence
-
a year ago
2022-05-31 10:30
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
US Social Security Number
PCRE2 (PHP >=7.3)
Finds a number that is 9 digits long. Can have spaces or hyphens in between the numbers and will still be found
Submitted by
anonymous
-
a year ago
2022-06-08 15:43
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Dice-Throwing notation
PCRE2 (PHP >=7.3)
You can express the required dice-throwing as usual: 1d10, 2d6, 3d8... The first part (dice number) is mandatory. So, notations like "D10" are not computed, and they must be written as 1d10 The dice number may be expressed as [number]o[number]. For example: 1o3d10. That will mark to implement a Gaus...
Submitted by
Hermes
-
a year ago
2022-07-10 10:57
(Last modified a year ago)
2022-07-10 11:14
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
HTML Minifier
PCRE2 (PHP >=7.3)
https://stackoverflow.com/questions/5312349/minifying-final-html-output-using-regular-expressions-with-codeigniter Thanks to @Alan Moore
Submitted by
anonymous
-
a year ago
2022-08-10 05:37
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Parse conventional commits message
PCRE2 (PHP >=7.3)
https://conventionalcommits.org Parses commits like type(scope)!: subject
Submitted by
Alex Kinnee
-
a year ago
2022-08-29 23:59
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Email with gmail+ implementation
PCRE2 (PHP >=7.3)
Regex of email with ability to add gmail's +example system example: root email = user@gmail.com gmail+ = user+extra@gmail.com
Submitted by
brad
-
a year ago
2022-09-02 18:33
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Palindromes
PCRE2 (PHP >=7.3)
Matches palindromes: arbitrary length ignores non-significant characters (spaces, ponctuation) ignores accents, provided the text is NFD-normalized recursive palindromes (e.g. "a été à"): either match the longest one ("a été à") or the nested ones individually ("a", "été", "à") (see comment)
Submitted by
NicolaF_
-
8 months ago
2023-02-01 17:47
(Last modified 8 months ago)
2023-02-02 08:27
2
2 upvotes, 0 downvotes (score 34.2%) (You must be signed in to vote)
Remove extra/useless python elements for GPT input.
PCRE2 (PHP >=7.3)
This RegEx removes unused elements such as inline comments and blank lines in python code. This will save you tokens and time when using GPT-3+ or ChatGPT to help code and debug.
Submitted by
LukeL
-
8 months ago
2023-02-01 19:16
(Last modified 8 months ago)
2023-02-02 00:41
1
2
3
4
...
117
Match any url in text or html (http, https)
3
3 upvotes, 0 downvotes (score 43.8%) (You must be signed in to vote)
Regular Expression
PCRE2 (PHP >=7.3)
/
(?:
http
[
s
]
?
:
\/\/
.
)?
(?:
www
\.
)?
[
-a
-
zA
-
Z0
-
9@%._
\+
~#=
]
{2,256}
\.
[
a
-
z
]
{2,6}
\b
(?:
[
-a
-
zA
-
Z0
-
9@:%_
\+
.~#?&
\/\/
=
]
*
)
/
gm
Open regex in editor
Description
Loading markdown...
Submitted by
Jérémy Munsch
-
2 years ago
2022-02-02 15:04