- or download this
my %escapes = (
'<' => '&lab;',
...
$s =~ s/($escapes_re)/$escapes{$1}/g;
return $s;
}
- or download this
my %escapes = qw( & & < &LAB; > &RAB; ( &LCB; ) &RCB; [ &LSB; ] &R
+SB; );
...
$s =~ s(/[&<>()\[\]])/$escapes{$1}/g;
return $s;
}
- or download this
my %escapes = qw( & & < &LAB; > &RAB; ( &LCB; ) &RCB; [ &LSB; ] &R
+SB; );
sub escape(_) { $_[0] =~ s(/[&<>()\[\]])/$escapes{$1}/gr }