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
Most upvotes
Most downvotes
Highest Score
Lowest Score
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 18,040 community submitted regex patterns...
1
scam_4
PCRE2 (PHP >=7.3)
In an HTML page, replace the text micro with µ. Oh, and don't screw up the code: don't replace inside or &entities;
Submitted by
anonymous
-
3 months ago
1
scam_20
PCRE2 (PHP >=7.3)
Validate a line in quotes. Return one (and only one) backreference with the text. ie: quoted text from "quoted text". Note: a \ escapes any char, so \" is a valid escape.
Submitted by
anonymous
-
3 months ago
1
scam_19
PCRE2 (PHP >=7.3)
Use substitution to put commas in all numbers to separate the thousands. ie: 12345678 → 12,345,678. The number could be in a sentence, and there may be more than one number in the sentence.
Submitted by
anonymous
-
3 months ago
1
scam_18
PCRE2 (PHP >=7.3)
Replace every other character if it's a \d with * (only those in even positions: 2, 4, 6, etc). Example: a1b2cde3g45hi6 should become abcdeg4hi6
Submitted by
anonymous
-
3 months ago
1
Validating IP V4
PCRE2 (PHP >=7.3)
VALIDATING IP V4 1.1.1.1 2.2.2.2 3.3.3.3 4.4.4.4 5.5.5.5...
Submitted by
An0nym0us
-
3 months ago
1
Test
PCRE2 (PHP >=7.3)
This is a test
Submitted by
anonymous
-
3 months ago
1
Quiz_9_Match_An_Email
PCRE2 (PHP >=7.3)
Verify that a given e-mail address is valid. We all know how complex emails are, but despite this, let's give it a try and see what we can come up with. You could start by trying to match contact@regex101.com (denoted as @.).
Submitted by
anonymous
-
3 months ago
1
Quiz_10_Followed_by_#
PCRE2 (PHP >=7.3)
For every occurrence of the char #, match the previous character and save it in a group (backreference). Example: for the text "a#bc# -#", set backreferences with a, c and -. You are not allowed to consume the hash character.
Submitted by
anonymous
-
3 months ago
1
Quiz_11_Validate_Floating_Point_Number
PCRE2 (PHP >=7.3)
Check if a floating point number (e.g. 3.14159) is in a valid format.
Submitted by
anonymous
-
3 months ago
1
Quiz_8_HTML_Tags
PCRE2 (PHP >=7.3)
Strip all HTML tags from a string. HTML tags are enclosed in . The regex will be applied on a line-by-line basis, meaning partial tags will need to be handled by the regex. Don't worry about opening or closing tags; we just want to get rid of them all. Note: This task is meant to be a learning exe...
Submitted by
anonymous
-
3 months ago
2
Quiz_12_Match_Any_Number_Between_0-100
PCRE2 (PHP >=7.3)
Could you help me validate my input and only match positive integers between the range of 0 and 100? There can be several numbers in a string which I would want to retrieve. Try out these example strings: ...
Submitted by
anonymous
-
3 months ago
1
Quiz_7_Validate_An_IP
PCRE2 (PHP >=7.3)
Validate an IPv4 address. The addresses are four numbered separated by three dots, and can only have a maximum value of 255 in either octet. Start by trying to validate 172.16.254.1.
Submitted by
anonymous
-
3 months ago
2
Quiz_13_Match_Alternating_0s_And_1s_In_Any_Order
PCRE2 (PHP >=7.3)
I'm trying to match bit sequences which are alternating between 1 and 0 and never have more than one 1 or 0 in a row. They can be single digits. Try matching this: 0101010, 1010101010 or 1
Submitted by
anonymous
-
3 months ago
1
Quiz_6_Broken_Keyboard
PCRE2 (PHP >=7.3)
Oh no! It seems my friends spilled beer all over my keyboard last night and my keys are super sticky now. Some of the time whennn I press a key, I get two duplicates. Can you ppplease help me fix thhhis? Substitute with $1
Submitted by
anonymous
-
3 months ago
2
Quiz_14_Spam_filter
PCRE2 (PHP >=7.3)
Match a string that contains any of the following substrings: http://, www., porn, or credit card. But don't match the text if it contains one of: not allowed, filter, or mirc. Don't use word boundaries (anywhere in the text is fine). If you need help, try reading this.
Submitted by
anonymous
-
3 months ago
1
Quiz_5_Whitespace
PCRE2 (PHP >=7.3)
Find all occurrences of 4 or more whitespace characters in a row throughout the string.
Submitted by
anonymous
-
3 months ago
2
Quiz_15_Not_surrounded_by_digits
PCRE2 (PHP >=7.3)
Replace every . (dot) with a - (hyphen) except when the dot is surrounded by digits. E.g.: .a.b.1.2. should become -a-b-1.2-
Submitted by
anonymous
-
3 months ago
1
Quiz_4_Retrieve_Numbers
PCRE2 (PHP >=7.3)
Count the number of integers in a given string. Integers are, for example: 1, 2, 65, 2579, etc.
Submitted by
anonymous
-
3 months ago
2
Quiz_16_Repeated_Words
PCRE2 (PHP >=7.3)
I'd like to know if a text contains words with 4 characters or more which are repeated 3 or more times in the text (anywhere in the text). If so, set one (and only one) backreference for each word.
Submitted by
anonymous
-
3 months ago
1
Quiz_3_Uppercase_Consonants
PCRE2 (PHP >=7.3)
With regex you can count the number of matches. Can you make it return the number of uppercase consonants (B,C,D,F,..,X,Y,Z) in a given string? E.g.: it should return 3 with the text ABcDeFO!. Note: Only ASCII. We consider Y to be a consonant! Example: the regex /./g will return 3 when run against ...
Submitted by
anonymous
-
3 months ago
1
...
3
4
5
6
7
...
902
Community Library Entry
0
Regular Expression
PCRE2 (PHP >=7.3)
/
(
(
https
?
:
)?
\/\/
)?
(
(
[
\d\w
]
|
%
[
a
-
fA
-
f
\d
]
{2,2}
)+
(
:
(
[
\d\w
]
|
%
[
a
-
fA
-
f
\d
]
{2,2}
)+
)?
@
)?
(
[
\d\w
]
[
-
\d\w
]
{0,253}
[
\d\w
]
\.
)+
[
\w
]
{2,63}
(
:
[
\d
]
+
)?
(
\/
(
[
-+_~.
\d\w
]
|
%
[
a
-
fA
-
f
\d
]
{2,2}
)*
)*
(
\?
(
&
?
(
[
-+_~.
\d\w
]
|
%
[
a
-
fA
-
f
\d
]
{2,2}
)
=
?
)*
)?
(
#
(
[
-+_~.
\d\w
]
|
%
[
a
-
fA
-
f
\d
]
{2,2}
)*
)?
/
gmi
Open regex in editor
Description
check for urls
Submitted by
naxmefy
-
3 years ago