string text = "C://aa//b.text"; string s=System.Text.RegularExpressions.Regex.Replace(text,@"([A-Za-z]://)([^/]\w+//)+(\w+).text","http://10.11.22.33/a/$3.text",System.Text.RegularExpressions.RegexOptions.IgnoreCase); Response.Write(s);