Help for this page

Select Code to Download


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