Help for this page

Select Code to Download


  1. or download this
    $ cat pm_1055846_name_id_data.txt
    bananas 456
    ...
    bana 20
    bana-na 15
    na 10
    
  2. or download this
    $ cat pm_1055846_name_replace_data.txt
    bananas,oranges
    ...
    bananas,oranges,pineapples,peaches,kiwis
    bana-na,banana
    ba-na-na,bana-bana,bana-nana
    
  3. or download this
    $ cat pm_1055846_name_replaced_out.txt
    456,23
    ...
    456,23,pineapples,897236,3726
    15,25
    ba-10-10,20-20,20-nana
    
  4. or download this
    my $re = '\b(' . join('|', keys %id_for) . ')\b';
    
  5. or download this
    my $re = '\b(' . join('|', sort { $b cmp $a } keys %id_for) . ')\b';
    
  6. or download this
    $ cat pm_1055846_name_replaced_out.txt
    456,23
    ...
    456,23,pineapples,897236,3726
    15,25
    ba-na-na,bana-bana,bana-nana
    
  7. or download this
    my $re = '\b(' . join('|', keys %id_for) . ')\b';
    
  8. or download this
    my $re = '(^|,)(' . join('|', sort { $b cmp $a } keys %id_for) . ')(?=
    +,|$)';
    
  9. or download this
    s/$re/$id_for{$1}/g;
    
  10. or download this
    s/$re/$1$id_for{$2}/g;