use strict;
my $str = '';
my $regex = qr/(?i)piss|slut|assfucker|asshole|brainfuck|bullshit|bullshitting|bumfuck|buttfuck|clusterfuck|cock sucker|cock suckers|cock sucking|cock tease|cock teaser|cocksuck|cocksucker|cocksuckers|cocksucking|cocktease|cockteaser|cunt|cunting|cunts|dick face|dick head|dickface|dickfuck|dickhead|dickheads|dickless|faggot|faggots|fingerfuck|fistfuck|fuck|fuck up|fuckboy|fuckcity|fuckdown|fucked|fucker|fuckery|fuckface|fuckfaces|fuckin|fucking|fuckload|fucknut|fucknuts|fucks|fucktard|fuckton|fuckup|fuckville|fuckwad|fuckwads|motherfucker|motherfuckin|motherfucking|nigger|niggers|ratfuck|ratfucking|shit|shite|shithole|shitlicker|shitload|shitloads|shits|shittier|shittiest|shitting|shitty|suck dick|suck my dick|titandass|titfuck|unfuckwithable|wank
/mp;
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