I don't have access to a platform that lets me use the PHP callback function, but this may get you on the right path.
Separating the 2 types of tag, I have used a pattern of:
\[tag:[^:]*:([^\]]*)\]
and a replacement string of
#$1
with the "ignore case" option set to locate and replace the "Tag:" items; and the pattern of:
\[user:(\d+)[^\]]*\]
and the replacement string of:
{User:$1}
(again with the "ignore case" option set) to do the same thing with the "user" items - in this case I simply put back the same number to make sure that the rest was working.
Of course, you can combine these patterns into:
\[tag:[^:]*:([^\]]*)\]|\[user:(\d+)[^\]]*\]
(these can be factored but that doesn't change the rest of the processing). Now, if something is captured in match group #1, then you know that this was a "tag" entry and can construct the suitable replacement string in the callback. Similarly, if characters are captured in match group #2, then you can use the digits to perform your lookup and again build the required replacement string.
The callback function code then becomes a "simple matter of programming" which can be "left as an exercise for the reader".
Hope this helps
Susan
PS: The resulting string from the first replacement is:
I love-love-love what [User:5138532:dgoldstein] and his #erongo kids have done with our #connected blog! (You all should go and leave lots of comments for them!) http://countryconnection.edublogs.org/
My guys will do some catching up once our exams are out of the way!
(ping [User:1392073:lisaroberson], [User:1546074:jeanesmith1])
and the second replacement is:
I love-love-love what {User:5138532} and his [Tag:738533:erongo] kids have done with our [Tag:800657:connected] blog! (You all should go and leave lots of comments for them!) http://countryconnection.edublogs.org/
My guys will do some catching up once our exams are out of the way!
(ping {User:1392073}, {User:1546074})