Help for this page

Select Code to Download


  1. or download this
    use warnings;
    $sentence='kinase inhibitor SET6 activates p16(INK4A) in cell-wall.';
    ...
    my $phrases_re = join '|', map { quotemeta } @phrases;
    $sentence =~ s/(^| )($phrases_re)(?= |$)/$1#$2#/g;
    print $sentence, "\n";
    
  2. or download this
    kinase #inhibitor# #SET6# activates #p16(INK4A)# in cell-wall.
    
  3. or download this
    $sentence =~ s/(^| )($phrases_re)( |$)/$1#$2#$3/g for 0, 1;
    
  4. or download this
    use 5.010; given ($sentence) { s/ /  /g; s/(^| )($phrases_re)( |$)/$1#
    +$2#$3/g; s/  / /g; }
    
  5. or download this
    my %phrase; $phrase{$_}++ for @phrases;
    my @sentence = split /( +)/, $sentence;
    for (@sentence) { $phrase{$_} and $_ = "#" . $_ . "#"; };
    $sentence = join "", @sentence;
    
  6. or download this
    $sentence =~ s/(?<![^ ])($phrases_re)(?= |$)/#$1#/g;