Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+
/
i
Input 1
# Above is a blank line, no match. foo bar baz this is a string Testing <> Hello, World This is less than <, this is greater than >. a < 3 && b > 3 <<Important Text>> # Not HTML-like. <p>fizz buzz</p> <a>this is a string</a> this is a <b>string</b> <p>Testing</p> <img src="hello.jpg"> <a>Foo</a> <input type='submit' value='Ok' /> <input type='submit' value='Ok'> <br/> <br> <hr> Foo & bar # These one-line samples are totally HTML-like. <file-upload> <absurd example> <closed example></closed> # Custom tags. <a> # Not matched by others, but actually valid. My < weird > string # Not actually a false positive; this is valid HTML! # Sample "smallest complete HTML document": <!DOCTYPE html> <title>testing</title> <p>This is a test.</p> <strange>This is strange.</strange> # And yes, <strange> IS VALID HTML. résume résume rÉsume r&x00C9;sume # Entities # List Tricks <ul><li>Foo</li ><li>Bar</li ></ul> # From https://stackoverflow.com/a/51325984/211827 Hello, World Thi
Substitution
# Above is a blank line, no match. foo bar baz this is a string Testing <> Hello, World This is less than <, this is greater than >. a < 3 && b > 3 <<Important Text>> # Not HTML-like. <p>fizz buzz</p> <a>this is a string</a> this is a <b>string</b> <p>Testing</p> <img src="hello.jpg"> <a>Foo</a> <input type='submit' value='Ok' /> <input type='submit' value='Ok'> <br/> <br> <hr> Foo & bar # These one-line samples are totally HTML-like. <file-upload> <absurd example> <closed example></closed> # Custom tags. <a> # Not matched by others, but actually valid. My < weird > string # Not actually a false positive; this is valid HTML! # Sample "smallest complete HTML document": <!DOCTYPE html> <title>testing</title> <p>This is a test.</p> <strange>This is strange.</strange> # And yes, <strange> IS VALID HTML. résume résume rÉsume r&x00C9;sume # Entities # List Tricks <ul><li>Foo</li ><li>Bar</li ></ul> # From https://stackoverflow.com/a/51325984/211827 Hello, World Thi