Please enable JavaScript to use regex101
Regular
Expressions
101
Support Regex101
Social
Info
Regex Editor
Community Library
Account
Regex Quiz
Order By
Most Recent
Most upvotes
Most downvotes
Highest Score
Lowest Score
Filter by Flavor
PCRE2 (PHP)
JavaScript
Python
Golang
Java
.NET 10.0 (C#)
Rust
POSIX ERE
POSIX BRE (grep/sed)
PCRE (Legacy)
Sponsors
Learn to code interactively with bite-sized, hands-on programming challenges.
Community Library
Search community submissions...
0/512
42
Cron schedule
Created
·
2016-06-02 15:45
Type
·
Unit Tests
Flavor
·
PCRE (Legacy)
Recommended
·
Validate cron lines (even the ones commented out)
Submitted by
Anonymous
36
Parsing browser User Agents
Created
·
2015-01-23 16:47
Updated
·
2023-07-19 08:36
Type
·
Match
Flavor
·
PCRE (Legacy)
From a (fairly large) list of User Agent strings, extract the OS, Browser, and Device Type.
Submitted by
OnlineCop
13
Conventional Commits validation
Created
·
2022-01-03 20:30
Updated
·
2022-04-05 20:20
Type
·
Match
Flavor
·
Python
This regex prevents the writing of non-standard conventional commits. I'm available on my github
Submitted by
Krisque
15
RFC3339 DateTime
Created
·
2016-02-12 11:44
Type
·
Match
Flavor
·
PCRE (Legacy)
Recommended
·
Validates a RFC3339 DateTime format. Does not validates the Data
Submitted by
Anonymous
12
Find Reddit Threads
Created
·
2015-03-12 09:23
Type
·
Match
Flavor
·
Python
Simply searches for the thread-id in any kind of valid reddit-URL.
Submitted by
Mio
11
extract subdomain(if available) or domain from URL
Created
·
2016-04-08 13:05
Type
·
Substitution
Flavor
·
Python
This regex should extract the subdomain, if any, or the domain, if no subdomain is used, from an arbitrary URL
Submitted by
trevi@twanda.com
6
Find and extract email domain
Created
·
2016-04-03 17:03
Type
·
Match
Flavor
·
Python
Find and extract email domain. Ex: test@example.pt -> extract 'example.pt'
Submitted by
Fnxk
6
Quartz Cron Validation
Created
·
2015-07-27 12:13
Type
·
Match
Flavor
·
PCRE (Legacy)
http://stackoverflow.com/questions/2362985/verifying-a-cron-expression-is-valid-in-java
Submitted by
Anonymous
10
entity
Created
·
2015-11-20 01:12
Type
·
Match
Flavor
·
Python
no description available
Submitted by
Anonymous
83
Distinguish torrent files (series vs movies)
Created
·
2014-06-26 09:59
Updated
·
2023-07-20 15:08
Type
·
Match
Flavor
·
Python
A neat regex for finding out whether a given torrent name is a series or a movie. Returns the full name of the series with the separator needed to make it pretty (ie, replace it with space or what you want). Also returns the season number or the year for the movie/series, depending on what was previously matched.
Submitted by
Firas Dib
14
Match Gmail Email
Created
·
2014-11-20 23:58
Type
·
Match
Flavor
·
PCRE (Legacy)
Recommended
·
Match Gmail Email
Submitted by
Óscar EnrÃquez
9
Fixo LDN CSP e SEM CSP
Created
·
2014-11-18 14:02
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Marcos Müller
485
regex101.com permalink id grabber
Created
·
2013-12-12 13:09
Updated
·
2024-04-11 14:32
Type
·
Match
Flavor
·
PCRE (Legacy)
Grabs the ID for the regex101.com permalink code. If a revision number is provided, grab that as well.
Submitted by
chris mccoy
238
Matching email addresses per RFC5322
Created
·
2013-10-23 17:46
Type
·
Match
Flavor
·
PCRE (Legacy)
The BNF rules from RFC 5322 transformed to PCRE by Nikita Popov and described in the post http://nikic.github.io/2012/06/15/The-true-power-of-regular-expressions.html.
Submitted by
Michael Musson
10
MikroTik FireWall
Created
·
2015-05-30 10:27
Type
·
Match
Flavor
·
PCRE (Legacy)
Regex used in Splunk to extract fields from Mikrotik FW. NOTES: Mikrotik must be configured to use "BSD Syslog" format FW rules must add, as log prefix, the action: drop accep reject etc...
Submitted by
HappyIdeasMaker
11
remove comments from php code
Created
·
2015-05-26 15:18
Type
·
Substitution
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Anonymous
5
get specific value from html tag
Created
·
2016-09-25 06:08
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
A.ROA
5
Match Only Text
Created
·
2016-07-05 03:56
Type
·
Match
Flavor
·
Python
no description available
Submitted by
Anonymous
5
psswd
Created
·
2016-03-24 09:04
Type
·
Match
Flavor
·
Python
no description available
Submitted by
Anonymous
5
Form Tag
Created
·
2016-02-26 06:49
Type
·
Match
Flavor
·
Python
Form Tag
Submitted by
Jay Patel
5
look for any $_POST['name']
Created
·
2016-01-14 23:35
Type
·
Match
Flavor
·
PCRE (Legacy)
if you are as lazy as me and want to replace every "=$_POST['name'];" using Dreamweaver or any development tool that allows using regular expressions to search in current file/document.
Submitted by
Kevinator
5
import url image
Created
·
2015-12-18 08:44
Type
·
Match
Flavor
·
Python
import url image
Submitted by
bartimeys
5
Validate hex color
Created
·
2015-12-02 11:14
Type
·
Match
Flavor
·
PCRE (Legacy)
Validates hexadecimal color codes based on the following rule set: Optionally starting with a hash. 3 or 6 characters in length. Using the [0-9a-f] character set.
Submitted by
Nathaniel Blackburn
5
Codice fiscale italiano
Created
·
2015-10-09 09:14
Type
·
Match
Flavor
·
PCRE (Legacy)
Oltre a supportare le omocodie controlla in modo restrittivo il carattere relativo al mese di nascita
Submitted by
Aldo Medri
5
Variable name of code
Created
·
2015-09-19 11:18
Type
·
Match
Flavor
·
PCRE (Legacy)
To get a variable name from a source code: The variable name is before the '=' (equal sign) This is the way to detect. Problem: Only 1 variable can get from 1 line. Unfortunately, this can get variable between after "//" and before ";" too. I made this for fake script debugger. Just get variable from source code and put that after last semicolon with so much tab and messagebox code for every line.
Submitted by
Setsuna
5
relative to absolute
Created
·
2015-01-20 01:16
Type
·
Substitution
Flavor
·
PCRE (Legacy)
relative to absolute
Submitted by
xp_prg
7
Remove Widows (PHP)
Created
·
2015-09-13 13:44
Type
·
Substitution
Flavor
·
PCRE (Legacy)
Adds a non-breaking space between the last two words of sentences
Submitted by
herkulano
7
IOS3166 Country Code Identification REGEX
Created
·
2015-06-07 04:48
Type
·
Substitution
Flavor
·
Python
IOS3166 Country Code Identification REGEX
Submitted by
theitgeek@recu.org.uk
7
validate US (5 & 9 digit) ZipCodes and CA PostalCodes
Created
·
2015-05-15 18:00
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Anonymous
7
[A-Za-z\x{0600}-\x{06FF}\x{1000}-\x{1021}_-][-\w]*
Created
·
2014-11-03 16:04
Type
·
Substitution
Flavor
·
PCRE (Legacy)
A-Za-z\x{0600}-\x{06FF}\x{1000}-\x{1021}_-*
Submitted by
[A-Za-z\x{0600}-\x{06FF}\x{1000}-\x{1021}_-][-\w]*
7
SO: fail2ban regular to find 403 request in nginx
Created
·
2014-09-15 11:32
Updated
·
2023-07-27 20:59
Type
·
Match
Flavor
·
Python
http://stackoverflow.com/q/25778420/2072035
Submitted by
Anonymous
4
semver
Created
·
2014-10-03 18:53
Type
·
Match
Flavor
·
PCRE (Legacy)
Recommended
·
Semantic Versioning regex pattern according to Tom Preston-Werner http://semver.org/ https://github.com/mojombo/semver/blob/master/semver.md First version of this regex follows semver 2.0.0. Discussion of semver and this regex was posted on https://github.com/mojombo/semver.org/issues/59
Submitted by
@gvlx <Gerardo Lisboa>
18
Date Regex(DD/MM/yyyy)
Created
·
2015-08-26 06:25
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
alcaamado
20
Between tags content
Created
·
2015-10-24 10:52
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Agustín Bouillet
8
Sentence grabber /w extra check
Created
·
2014-05-29 17:30
Type
·
Match
Flavor
·
PCRE (Legacy)
Grabs sentences including terms like: e.g. z.b. Figs.These get caught in 1st capturing group. Problem: how to only accept matching sentences which contain pattern \b\d+[a-z]{0,2}\b?
Submitted by
light0
11
Codice fiscale
Created
·
2015-08-19 10:43
Type
·
Match
Flavor
·
PCRE (Legacy)
Check "codice fiscale"
Submitted by
Luca
9
IPv4 Validator
Created
·
2020-07-26 21:19
Updated
·
2023-08-07 17:36
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Anonymous
9
Letters, numbers and blank space
Created
·
2016-01-04 17:31
Type
·
Match
Flavor
·
PCRE (Legacy)
The following regular expression matches only letter a-z A-Z numbers 0-9 and a blank space for a given string.
Submitted by
Jordan Raychev
9
English date in "dd mmmm yyyy" format
Created
·
2015-05-18 19:41
Type
·
Match
Flavor
·
Python
Parse an English date following the "dd mmmm yyyy" format.
Submitted by
Tantale
9
Extract url GET parameters
Created
·
2014-09-16 08:37
Type
·
Match
Flavor
·
PCRE (Legacy)
Returns key/value pair of a url. Also works with google fonts which has additional information
Submitted by
Anonymous
17
Capture comma separated numbers
Created
·
2015-07-19 01:57
Type
·
Match
Flavor
·
PCRE (Legacy)
Capture comma separated numbers, no matter if there are spaces before or after the commas.
Submitted by
Fernando Nunes
31
ninite
Created
·
2015-09-29 11:28
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
peek
29
Wrap long string to spec length
Created
·
2013-07-21 20:34
Type
·
Substitution
Flavor
·
PCRE (Legacy)
no description available
Submitted by
fullpipe
10
Just validate one sequence of
Created
·
2014-10-23 13:22
Type
·
Match
Flavor
·
PCRE (Legacy)
sdfs sdfs FLBREV00022230 dsfsdfs sdfsf FLBREV00022234 In this case is false
Submitted by
Fiipe
29
CSV line parsing
Created
·
2014-10-15 13:22
Type
·
Match
Flavor
·
PCRE (Legacy)
Captures all fields from a CSV file's line. Can be customized with user-defined field separator and protecting character.
Submitted by
Various
53
Disorted Email Addresses
Created
·
2013-01-16 14:11
Type
·
Substitution
Flavor
·
PCRE (Legacy)
Matches distorted email addresses and converts them back to real ones.
Submitted by
dislick
19
Date: DD-MM-YYYY hh:mm:ss
Created
·
2013-05-17 13:07
Type
·
Match
Flavor
·
PCRE (Legacy)
Recommended
·
Validate and capture dateTime parts, includes validation for leap years, range 1000-2999. Fixed bug
Submitted by
Ka.
7
Max - URL Extract
Created
·
2016-05-09 10:38
Type
·
Match
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Ayush
22
UK Postcode Checker
Created
·
2014-10-21 08:23
Type
·
Match
Flavor
·
PCRE (Legacy)
Checks for valid UK/British postcodes. There was another on here that had for some reason been upvoted, but it was actually incorrect as it worked on none of my valid own postcodes! Namely that it assumed two letters and a number (BS3) when you can have variations (M20). Allows for an optional space and separates the two parts into groups.
Submitted by
MaffooBristol
4
INI Parser
Created
·
2020-03-03 01:56
Type
·
Match
Flavor
·
PCRE (Legacy)
Created for purpose of reading an INI file in C# applications. Supports comments and comment escape characters. I plan to add more escape characters (such as \=). s - Section scp - Section Comment Prefix sc - Section Comment k - Key v - Value kvcp - KeyValue Comment Prefix kvc - KeyValue Comment cp - Comment Prefix c - Comment I am open to any suggestion that may improve upon this regex, and/or would allow me to learn more. Created by Raxdiam
Submitted by
Raxdiam
Load More
Community Library Entry
11
Regular Expression
Open Workspace
@
(?(DEFINE)
(?<next_open_tag>
[^
<
]
*+
(?i:
<
++
[^
<?s
][^
<
]
*
|
<
++
(?!
\?
php
|
\?
=
|
script
\s
*
language
\s
*
=
\s
*
(
[
\'
"
]
?
)
php
\g{-1}
\s
*
>
)
[^
<
]
*
)*+
(?i:
<
++
(?:
\?
php
|
\?
=
|
[^
>
]
+
)
|
\z
)
)
)
\A
(?&next_open_tag)
\K
|
[^
'"`/#<?
]
*+
(?:
'
(?:
[^
'
\\
]
+
|
\\
.
)*+
'
[^
\'
"`/#<?
]
*
|
"
(?:
[^
"
\\
]
+
|
\\
.
)*+
"
[^
\'
"`/#<?
]
*
|
`
(?:
[^
`
\\
]
+
|
\\
.
)*+
`
[^
\'
"`/#<?
]
*
|
/
(?!
[
/*
]
)
[^
\'
"`/#<?
]
*
#
stop
for
//
or
/*
|
#
if
close
tag
?>
\?
(?:
>
(?&next_open_tag)
[^
\'
"`/#<?
]
*
|
)
|
<
(?:
#
heredoc
or
nowdoc
<<
[
\
\t
]
*
(
[
\'
"
]
?
)
(
[
a
-
zA
-
Z_
\x7f-\xff
][
a
-
zA
-
Z0
-
9_
\x7f-\xff
]
*
)
\g{-2}
[
\
\t
]
*
[
\r\n
]
(?-s:
.
*+
[
\r\n
]
)*?
\g{-1}
[
\r\n
;
]
[^
\'
"`/#<?
]
*
|
(?i:
/script
\s
*
>
)
(?&next_open_tag)
[^
\'
"`/#<?
]
*
|
[^
\'
"`/#<?
]
*
)
)*+
\K
(?:
(?:
//
|
\#
)(?:
[^
\n
?
]
+
|
\?
(?!
>
)
)*+
#
single
line
comment
//
и
#
|
/
\*
(?:
[^
*
]
+
|
\*
(?!
/
)
)*+
\*
/
#
multi
line
comment
/*
*/
)?
@
xsg
Description
Created
·
2015-05-26 15:18
Type
·
Substitution
Flavor
·
PCRE (Legacy)
no description available
Submitted by
Anonymous
Open Workspace