I just tried but it loops endlessly, any idea why?
–
scalSep 3 '11 at 14:56

Maybe your hash contains a value looking like ${...}? I can't say without knowing your input and your hash content. You may include a debug output or put a break point just in the last line and look for variable and rep each time.
–
HowardSep 3 '11 at 14:58

The loop keeps returning the same regexp match (userName), it doesn't loop trough each match. so if I have "username = '${userName}' and password= = '${password}'" it loops and outputs (debug): variable = ${userName} rep = John Doe so it's correct but just keeps looping and outputing that and never the ${password} one
–
scalSep 3 '11 at 15:07

Stupid me, forgot to type the m.replace() in the code, and they say copy/paste is bad practice! :)
–
scalSep 3 '11 at 15:09