I want a regex that would work as follows: I have a string like {hey.yo.wat}, the string is by itelf and always must start with a { and end with a }, the first backreference would contain a 'hey.yo.', the second 'yo.' and the third, 'wat'. If the string is only something like {hey.yo}, you would get 'hey.' for the first and second backreferences and 'yo' would be the third backrefernce. How should I build the regex?