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
/
可愛(?=貓)
/
gu
Input 1
1
New
// 正向前瞻 const str1 = "可愛貓,可愛狗,可愛兔"; const regex1 = /可愛(?=貓)/g; console.log(str1.match(regex1)); // 負向前瞻 const str2 = "可愛貓,可愛狗,可愛兔"; const regex2 = /可愛(?!貓)/g; console.log(str2.match(regex2)); // 正向後顧 const str3 = "可愛貓,可愛狗,可愛兔"; const regex3 = /(?<=可愛)貓/g; console.log(str3.match(regex3)); // 負向後顧 const str4 = "可愛貓,野生貓,可愛兔"; const regex4 = /(?<!可愛)貓/g; console.log(str4.match(regex4)); // 嵌套 "Alice: 95, Bob: 88, Charlie: 92, David: 85";