const regex = /[幹乾淦贛干肏操糙去草塞賽]?[林賃吝零靈齡拎恁你他她它祂牠]([馬马量梁良糧涼娘妹媽]|老[師蘇詩屍濕溼]|奶奶|祖?(嬤|媽|罵))(的|樂|叻|垃|勒|咧|([基唧雞機激][掰歪]))?|[靠尻哭][杯倍背貝輩悖北盃悲卑揹腰邀妖夭幺么]|([基唧雞機激](車|[教轎窖嶠叫較趴葩]|[掰歪]))|(([魯盧擄虜盧爐]|[假呷吃甲賈卡]|[衝沖充銃欉謥]?[三殺沙砂啥])[小洨曉])|(破[麻目])|([俗卒][仔臘辣])|[賤屌肏操糙]|(幹(?![麻嘛嗎]|(啥|[蛇神什甚]麼|[好壞]事)))|(靠(?!在|的|他|你|妳|她))|([林賃吝拎恁你][霸爸北背])|([懶藍覽攬欖][教轎窖嶠叫較趴葩])|([白北度杜渡肚虎唬][爛濫纜藍覽懶])|(智[缺障仗丈瘴])|(去你的)|((?i)GG\s?IN\s?IN)|(想[樓揉])|(ㄈㄈ尺)|((?i)ccr|fuck|hell|shit|ass(hole)?|idiot|damn|bitch|phycho|bastard|Whore|Slut)/g;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('[幹乾淦贛干肏操糙去草塞賽]?[林賃吝零靈齡拎恁你他她它祂牠]([馬马量梁良糧涼娘妹媽]|老[師蘇詩屍濕溼]|奶奶|祖?(嬤|媽|罵))(的|樂|叻|垃|勒|咧|([基唧雞機激][掰歪]))?|[靠尻哭][杯倍背貝輩悖北盃悲卑揹腰邀妖夭幺么]|([基唧雞機激](車|[教轎窖嶠叫較趴葩]|[掰歪]))|(([魯盧擄虜盧爐]|[假呷吃甲賈卡]|[衝沖充銃欉謥]?[三殺沙砂啥])[小洨曉])|(破[麻目])|([俗卒][仔臘辣])|[賤屌肏操糙]|(幹(?![麻嘛嗎]|(啥|[蛇神什甚]麼|[好壞]事)))|(靠(?!在|的|他|你|妳|她))|([林賃吝拎恁你][霸爸北背])|([懶藍覽攬欖][教轎窖嶠叫較趴葩])|([白北度杜渡肚虎唬][爛濫纜藍覽懶])|(智[缺障仗丈瘴])|(去你的)|((?i)GG\\s?IN\\s?IN)|(想[樓揉])|(ㄈㄈ尺)|((?i)ccr|fuck|hell|shit|ass(hole)?|idiot|damn|bitch|phycho|bastard|Whore|Slut)', 'g')
const str = `幹
幹嘛
幹麻
幹甚麼好事
幹他媽的
幹你娘
乾
乾淨
乾林老師
靠
靠北
靠你了
靠北邊
靠杯
靠背
靠盃
靠腰
靠夭
哭夭
幹靈糧
去你的
去你媽的
林北
恁北
恁娘
恁祖媽
機掰
賤
俗辣
他媽的
覽趴
懶趴
北爛
盧小
魯洨
色龜
肚爛
放屁
屁股
屌
啥小
三小
操
屁
唬爛
龜公
他奶奶的
犯賤
機車
智缺
你娘卡好
林老師
破麻
賽
操卒仔
操機歪
糙機掰
無懶趴
卡小
吃小
死魚眼
炭甲查某
糙你妹
GGININ
GG IN IN
GG IN IN DER
gginin
可惡 想揉
想揉
ㄈㄈ尺
英文原生:
CCR
Fuck off
Fuck
mother fucker
You SOB
son of a bitch
Go to hell
Shit-head
Asshole
You beast
Shit
fart
Idiot
damn it
God damn
God damn it
hypocrite
ass hole
ass licker
bitch
phycho
bastard
Whore
Slut
Shit-head
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions