fork download
  1. # Command-line params cannot be passed in in ideone,
  2. # so I use the variable $x to simpulate the $* variable
  3. # which normally contains an array of string representing the params:
  4. $x = ["This 1 is22a 3352sentence 50", "3"]
  5.  
  6. a,b=$x
  7. p a.gsub(/\d+/){|s|s.to_i*b.to_i}
Success #stdin #stdout 0.01s 7452KB
stdin
Standard input is empty
stdout
"This 3 is66a 10056sentence 150"