Universal Spooky Meme Translator
Ruby, 50 44 43 bytes
FGITW answer. Gotta go fast!
Thanks to @Neil for saving 6 bytes.
Oh right, crossed out 44 is still 44
->m,t{m.gsub(/\d+/){eval$&+t.sub(?^,'**')}}
Perl, 36 34 bytes
s/\d+/"0|$&$^I"=~s#\^#**#r/gee
The source code is 30 bytes long and it requires the switches -pi
(+4 bytes). It takes the first input from STDIN, the second input as an argument to -i
.
Thanks to @DenisIbaev for golfing off 2 bytes!
Test it on Ideone.
Jolf, 15 14 bytes
ρi«\d+»dC!6+HI
Try it here!
Explanation
ρi«\d+»dC!6+HI
ρ «\d+» replace all digits
i in the input
d (functional replace)
!6 eval (using jolf's custom infix eval)
+H the number as a string plus
I the second input
C floor the result (integer truncate)
Fun to note, I updated Jolf after this challenge, adding some RegExp builtins. This could be 12 11 bytes:
ρiLRdC!6+HI