I need to parse a string in ruby which contain vars of ids and names like this {2,Shahar}.
The string is like this:
text = "Hello {1,Micheal}, my name is {2,Shahar}, nice to meet you!"
when I am trying to parse it, the regexp skips the first } and I get something like this:
text.gsub(/\{(.*),(.*)\}/, "\\2(\\1)")
=> "Hello Shahar(1,Micheal}, my name is {2), nice to meet you!"
while the required resault should be:
=> "Hello Michael(1), my name is Shahar(2), nice to meet you!"
I would be thankful to anyone who can help.
Thanks Shahar