gsub and regex

Sorry everyone, but this is killing me…

I’ve got the following string:
[lua]http://www.{server}.com/ArticleDetails.html?username={username}&password={password}[/lua]

I need, using gsub (or something like it) to replace the segments in curly braces { and } with values read from another location in my code.

I have tried (among many, many, many other things) this:
[lua]url:gsub( “{server}”, serverName )[/lua]

To absolutely no joy.

Could someone tell me how to do string replacement in lua when the string segments I need to replace are surrounded by curly braces, please?

So, so many thank you’s if you can help me!

Matt. [import]uid: 8271 topic_id: 16465 reply_id: 316465[/import]

Your code works, but I think you need to set url:

url = url:gsub( "{server}", serverName )  

-Angelo [import]uid: 12822 topic_id: 16465 reply_id: 63034[/import]

Yes, in my case it turned out that I had a URL encrypted value in my username, and apparently that throws off the arguments to the replacement values. So, in this case, the ‘@’ needed to be ‘@’ and not the URL encoded version (I forget what it was.)

M [import]uid: 8271 topic_id: 16465 reply_id: 63036[/import]