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
r"
<div>\s*<p class="match">([\w\s]+)</p>[\w\s]+(?=<a class="a").*?</div>
"
gs
Input 1
New
<div> <p class="match"> this sentence should match </p> some text <a class="a"> some text </a> </div> <div> <p class="match"> this sentence should not match</p> some text <a class ="b"> some text </a> </div> <div> <p class="match"> this sentence should match </p> some text <a class="a"> some text </a> </div> <div> <p class="match"> this sentence shouldn't match</p> some text <a class ="b"> some text </a> </div>
Extraction
<div> <p class="match"> this sentence should match </p> some text <a class="a"> some text </a> </div> <div> <p class="match"> this sentence should not match</p> some text <a class ="b"> some text </a> </div> <div> <p class="match"> this sentence should match </p> some text <a class="a"> some text </a> </div> <div> <p class="match"> this sentence shouldn't match</p> some text <a class ="b"> some text </a> </div>