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"
(?m)^(?=.*(?:\r?\n(?!\r?\n).*)*?\bNew-York\b)(?=.*(?:\r?\n(?!\r?\n).*)*?\bBerlin\b).*(?:\r?\n(?!\r?\n).*)*
"
g
Input 1
1
New
This is paragraph #1 New-York, London, Paris, Berlin Some other text End of paragraph This is paragraph #2 London, Paris End of paragraph This is paragraph #3 New-York, Paris, Berlin Some other text End of paragraph This is paragraph #4 End of paragraph This is paragraph #5 Paris, Berlin Some other text End of paragraph
Extraction
This is paragraph #1 New-York, London, Paris, Berlin Some other text End of paragraph This is paragraph #2 London, Paris End of paragraph This is paragraph #3 New-York, Paris, Berlin Some other text End of paragraph This is paragraph #4 End of paragraph This is paragraph #5 Paris, Berlin Some other text End of paragraph