use strict; use warnings; my $input = "'C-3PO' or 'See-Threepio' is a humanoid robot character from the [[Star Wars]] universe who appears in the original ''Star Wars'' films, the prequel trilogy and the sequel trilogy."; my $regex = qr/('|\[\[|\]\])/; $input =~ s/$regex//g; print $input;