Rails Convert Array To String Python Replace Regex