• λ我爱Aspx >> Asp.Net >> 截取字符串
  • 截取字符串

  • :aspxer  Դ:csdn  :2007-7-6 2:46:43  ؼ:
  • 如何截取字符串“xxxx<img xx>xxxx</img>xxxxxx<img xx>xxxx</img>”

    google_ad_width = 250; google_ad_height = 250; google_ad_format = "250x250_as"; google_color_url = "000000";

    中<img xx>XXX</img>

    放入数组中。

    第2楼. 由 caoqinghua 于 2007-6-28 17:52:57 发表

    用正规则表达式验证,然后存到一个数组

    第3楼. 由 caoqinghua 于 2007-6-28 17:58:37 发表

    Dim doc As String = "" "需要验证的字符串

    Dim f As New System.Text.RegularExpressions.Regex("<img(?<body>[\s\S]*?)</img\>")

    Dim sum As Integer = f.Matches(doc).Count

    Dim col As System.Text.RegularExpressions.MatchCollection = f.Matches(doc)

    Dim temp(sum) As String

    For i As Integer = 0 To col.Count - 1

    temp(i) = col.Item(i).Groups(0).ToString

    Next

    第4楼. 由 wuyazhe 于 2007-6-28 22:36:05 发表

    楼上的正则结果是没错。不过按你的意思,这样的正则更合适:

    <img[^>]*>(?<body>[\s\S]*?)</img\>

    Ҷƪл˵?
  • һƪ文章内容自动分页
    һƪhtml:hidden 提交的值一直为null ,为什么?