Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $txt_original="Arkarmit ithaaatokkk ide? aaaztamindenit. tokkkal-vonoval";
- $txt_replaced=$txt_original;
- # megkeressuk a szukseges mintat
- $txt_replaced =~ /aaa(\w{5})/;
- # Ami a $1-be kerul. Onnan atmentjuk $text_to_replace -be
- $text_to_replace=$1;
- $txt_replaced =~ s/$text_to_replace/12345/g;
- print("To replace: ${text_to_replace}\n");
- print("Original: ${txt_original}\n");
- print("Replaced: ${txt_replaced}\n");
- # output:
- # -------
- #
- # To replace: tokkk
- # Original: Arkarmit ithaaatokkk ide? aaaztamindenit. tokkkal-vonoval
- # Replaced: Arkarmit ithaaa12345 ide? aaaztamindenit. 12345al-vonoval
Advertisement
Add Comment
Please, Sign In to add comment