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
/
\bKEYWORD1\b(?:(?<=\bKeyWord2\b.*?)|(?=.*?\bKeyWord2\b))
/
gm
Input 1
1
New
KEYWORD1 is ahead of Keyword2 KEYWORD1 is ahead of Keyword2 and another KeyWord2 KeyWord2 is behind KEYWORD1 KEYWORD1 is ahead of KEYWORD1 and behind KeyWord2 KeyWord2 is twice of KeyWord2 and in the end KEYWORD1 KEYWORD1 is
Extraction
KEYWORD1 is ahead of Keyword2 KEYWORD1 is ahead of Keyword2 and another KeyWord2 KeyWord2 is behind KEYWORD1 KEYWORD1 is ahead of KEYWORD1 and behind KeyWord2 KeyWord2 is twice of KeyWord2 and in the end KEYWORD1 KEYWORD1 is