我试了一下您的代码,出来的效果是没有把两边的 [ ] 给去掉,
string strTest = "The cat s cattere[img:(xxxx/xx.jpg)]d its [img:(tttx/tt.jpg)]food all [img)]over the room. ";
litTest.Text = Regex.Replace(strTest, @"(?<=\[)img:\((?<url>[^\)]*)\)(?=\])", "<img src=\"$1\" />");
出来的效果是:
The cat s cattere[<img src="xxxx/xx.jpg">]d its [<img src="tttx/tt.jpg">]food all [img)]over the room.