var strValue = "<img width=450 src="http;//www.url.com/images/aaa.jpg" hieght=300>";用正则表达式如何替换成下面的UBB代码?

解决方案 »

  1.   

    http;////www.url.com//images//aaa.jpg
    什么意思
      

  2.   

    c#:
    string rt=Regex.Replace(strValue, "^<img[^>]*src=((\"|\')?)([^>]*)\\1[ ]+[^>]*>$", "");
      

  3.   

    <img((?!src=).)*src="([^"]*)"[^>]*>替换为:
    测试页面:(推荐)
    http://www.regexlab.com/zh/replshop.asp?pat=%3Cimg%28%28%3F%21src%3D%29.%29*src%3D%22%28%5B%5E%22%5D*%29%22%5B%5E%3E%5D*%3E&rto=%5Bimg%5D%242%5B/img%5D&txt=%22%3Cimg%20src%3D%22http%3B//www.url.com/images/aaa.jpg%22%20hieght%3D300%3E%22%3B