Please enable JavaScript to use this web application.
Regular
Expressions
101
Social
Donate
Info
Regex Editor
Community Patterns
Account
Regex Quiz
Settings
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 7.0 (C#)
Rust
Sponsors
There are currently no sponsors.
Become a sponsor today!
Community Patterns
Search among 14,760 community submitted regex patterns...
1
Make PHP var_dump() output more compact
PCRE (PHP <7.3)
The PHP function var_dump() provides debugging output, but has more line-breaks than is needed for readability. This regex strips out the (in my eyes) unnecessary line-breaks. Good in a self written debugging method in combination with ob_start()and ob_get_contents().
Submitted by
Doqnach
-
7 years ago
1
URL Slugs Optimized
PCRE (PHP <7.3)
This slug regex is optimized using strictly my own opinions. Slugs: Should be english, alphanumeric phrases separated with a single dash. Should not contain single alpha character between dashes....
Submitted by
Jordon Baade
-
7 years ago
1
A revised e-mail validation regular expression
PCRE (PHP <7.3)
This one allows to begin with a digit, however, sometimes e-mail should begin with an *English letter *
Submitted by
anonymous
-
7 years ago
1
Date checker for X values
ECMAScript (JavaScript)
Work in progress
Submitted by
anonymous
-
7 years ago
1
Youtube ID Extractor
PCRE (PHP <7.3)
no description available
Submitted by
anonymous
-
7 years ago
1
Phone numbers and/or extensions(relaxed)
ECMAScript (JavaScript)
Useful for phone number extraction
Submitted by
hslayer
-
7 years ago
1
Localhost/private ip origin check
PCRE (PHP <7.3)
Used by CORS to check for localhost/private IP origins Check out the unit tests at /r/2Ofume/1/tests
Submitted by
ngokimphu
-
7 years ago
1
Formatar CPF
PCRE (PHP <7.3)
Retorna um cpf no formato 123.456.789-11. Cpf de entrada deve conter apenas números
Submitted by
anonymous
-
7 years ago
1
Matching email addresses per RFC5322
PCRE (PHP <7.3)
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
-
7 years ago
1
Matching an Saudi Postal Code
PCRE (PHP <7.3)
Saudi Postal Code has five digits, if you would to have more information check the below: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ First Digit (Postal Regions): "The postal region number is represented by the first digit of the postal code" ...
Submitted by
Fares Alarabi
-
7 years ago
1
Email matching with a grain of salt
PCRE (PHP <7.3)
Inspired by Micheal Musson entry Wich was hard to use in regex flavours that don't support recursion (C# engine doesn't) i've build my own simpler version wich matches what i would accept as validation entry
Submitted by
Luigi Trabacchin
-
7 years ago
1
Basic DOI
Python
no description available
Submitted by
anonymous
-
7 years ago
1
Contraseña Fuerte
PCRE (PHP <7.3)
Valida que la contraseña deba estar compuesta por una mayúscula, minúscula y números con un rango de caracteres desde 8 hasta 16 dígitos. Ejemplo Aropd123 Argpd 123
Submitted by
Nelson Wandurraga
-
7 years ago
1
Unix ANSI escape codes
PCRE (PHP <7.3)
Unix ANSI escape codes Hi , in my Terminal project in want a method to find (Unix ANSI escape codes) and run its command. For More information : https://en.wikipedia.org/wiki/ANSI_escape_code...
Submitted by
Shahin Pendar , shahinpendar@gmail.com
-
7 years ago
1
Check list of integers numbers separated by comma
PCRE (PHP <7.3)
Check list of integers numbers separated by comma Ex: "1, 2, 4, 6" >> OK "99" >> OK "a, b, c" >> WRONG...
Submitted by
anonymous
-
7 years ago
1
French Phone Number Validation
PCRE (PHP <7.3)
Accept several kind of format, more or less usual. And refuse incorrect formats. Prefix: 0033 / +33 / (0) / 0 Number: collapsed / group by 2 / group by 3 Separator: space / dot / dash
Submitted by
RonanKER
-
7 years ago
1
Validate and decompose email address (English alphabet compliant)
PCRE (PHP <7.3)
If you understand the regexp, you can adjust it to your need. restrict special characters to .%_'- (localpart) limit length of each part and the whole to reasonable size supports 'XN' tld If you need help, read http://www.regular-expressions.info/email.html See also https://www.debuggex.com/r/9cdaaw...
Submitted by
RonanKER
-
7 years ago
1
Capture the last space in a line of text with Negative Lookback
PCRE (PHP <7.3)
Looks for the last single space in a line of text.
Submitted by
anonymous
-
7 years ago
1
Acts
PCRE (PHP <7.3)
Extract Act names from statements
Submitted by
anonymous
-
7 years ago
1
Euro prices with steps of 5000 (e.g 5.000, 10.000 - 255.000)
PCRE (PHP <7.3)
To validate a price of 5.000 and steps of 5.000 thereafter. (e.g 5.000, 10.000, 15.000 etc) including a euro sign. If anyone has any improvements let me know, this is what i just came up with to solve a problem i have on WordPress Contact Form 7.
Submitted by
anonymous
-
7 years ago
1
...
631
632
633
634
635
...
738
remove comments from php code
11
Regular Expression
PCRE (PHP <7.3)
@
(?(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
Open regex in editor
Description
no description available
Submitted by
anonymous
-
9 years ago