use strict;
my $str = '幹
幹他媽的
幹你娘
乾
乾林老師
靠
靠北
靠杯
靠背
靠盃
靠腰
靠夭
哭夭
去你的
去你媽的
林北
恁北
恁娘
恁祖媽
機掰
賤
俗辣
他媽的
覽趴
懶趴
北爛
盧小
魯洨
色龜
肚爛
屌
啥小
三小
操
屁
唬爛
龜公
他奶奶的
犯賤
機車
智缺
你娘卡好
林老師
破麻
賽
操卒仔
操機歪
糙機掰
無懶趴
卡小
吃小
死魚眼
炭甲查某
糙你妹
GGININ
GG IN IN
GG IN IN DER
可惡 想揉
想揉
ㄈㄈ尺
英文原生:
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
';
my $regex = qr/[幹乾淦贛干肏操糙去塞賽]?[林賃吝拎恁你他她它祂牠](娘|媽|老師|妹|祖?(嬤|媽|罵))(的|樂|叻|垃|勒|咧|([基唧雞機激][掰歪]))?|([基唧雞機激][掰歪])/p;
if ( $str =~ /$regex/g ) {
print "Whole match is ${^MATCH} and its start/end positions can be obtained via \$-[0] and \$+[0]\n";
# print "Capture Group 1 is $1 and its start/end positions can be obtained via \$-[1] and \$+[1]\n";
# print "Capture Group 2 is $2 ... and so on\n";
}
# ${^POSTMATCH} and ${^PREMATCH} are also available with the use of '/p'
# Named capture groups can be called via $+{name}
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 Perl, please visit: http://perldoc.perl.org/perlre.html