Guest User

Untitled

a guest
Jun 20th, 2012
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $txt_original="Arkarmit ithaaatokkk ide? aaaztamindenit. tokkkal-vonoval";
  2. $txt_replaced=$txt_original;
  3.  
  4. # megkeressuk a szukseges mintat
  5. $txt_replaced =~ s/aaa(\w{5})/aaa12345/g;
  6. # Ami a $1-be kerul. Onnan atmentjuk $text_to_replace -be
  7. $text_to_replace=$1;
  8.  
  9. $txt_replaced =~ s/$text_to_replace/12345/g;
  10.  
  11. print("Original: ${txt_original}\n");
  12. print("Replaced: ${txt_replaced}\n");
  13.  
  14. # output:
  15. # Original: Arkarmit ithaaatokkk ide? aaaztamindenit. tokkkal-vonoval
  16. # Replaced: Arkarmit ithaaa12345 ide? aaa12345ndenit. tokkkal-vonoval
Advertisement
Add Comment
Please, Sign In to add comment