Guest User

Untitled

a guest
Jun 20th, 2012
42
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. # megkeressuk a szukseges mintat
  4. $txt_replaced =~ /aaa(\w{5})/;
  5. # Ami a $1-be kerul. Onnan atmentjuk $text_to_replace -be
  6. $text_to_replace=$1;
  7. $txt_replaced =~ s/$text_to_replace/12345/g;
  8.  
  9. print("To replace: ${text_to_replace}\n");
  10. print("Original: ${txt_original}\n");
  11. print("Replaced: ${txt_replaced}\n");
  12.  
  13. # output:
  14. # -------
  15. #
  16. # To replace: tokkk
  17. # Original: Arkarmit ithaaatokkk ide? aaaztamindenit. tokkkal-vonoval
  18. # Replaced: Arkarmit ithaaa12345 ide? aaaztamindenit. 12345al-vonoval
Advertisement
Add Comment
Please, Sign In to add comment