pcbar 正则之神进来帮忙分离这组代码!!!
本帖最后由 javarike 于 2009-6-22 00:16 编辑<script type="text/javascript">
var picArr ="/d/file/comic/2007-08-22/fb9f4dbcfb78192fca3648397322cf2b.png|/d/file/comic/2007-08-22/cf04b87fd3fdd5fb86d4fc4bf069254a.png|/d/file/comic/2007-08-22/766b32085b6c6a16a46df67b0e71046c.png|/d/file/comic/2007-08-22/7291df5dfd7b7fcc6ca46da290579708.png|/d/file/comic/2007-08-22/29c020d37387bc2c03dcd9bd0cfac7a2.png|/d/file/comic/2007-08-22/f2b626e9817acd2c5c77d8235bef693d.png|/d/file/comic/2007-08-22/5555c3e219ad41c25dab856eb45d3e9e.png|/d/file/comic/2007-08-22/91f80a87cb9bbaa6adb1a99a23f55fa4.png|/d/file/comic/2007-08-22/496e2a2a4599950983c80ae60a8934cd.png|/d/file/comic/2007-08-22/a06b3544ce1899b8c28813dc3baad66d.png|/d/file/comic/2007-08-22/4e5f68ba0465c2d03084cfd653e0ad4b.png|/d/file/comic/2007-08-22/6cb6b8ed8eaca6a00f78d933cfc37474.png|/d/file/comic/2007-08-22/a70a8022d32ebf15c6033cd029a4f90e.png|/d/file/comic/2007-08-22/ec85874c6dde571e184933dfc49ee8cd.png|/d/file/comic/2007-08-22/08c6a15679f14f17d1b1ab47e4329b34.png"
</script>
<script type="text/javascript" src="/js/comic.js"></script>
</div>
帮帮忙,将类似"/d/file/comic/2007-08-22/fb9f4dbcfb78192fca3648397322cf2b.png"上面这样的图片连接按照数组分出来,谢谢您了! 这种还要用到正则么?
用/来StringSplit好了 其实是在一个网页上面拿出来的....还没拿出来... 楼主给出的部分代码正则测试会出现制表符的小问题
需要稍微StringRegExpReplace 替换一下
不知道网页源代码是否也如此
如果能将源代码简单替代调整如下图的话
(/d/file/comic/\d{4}-\d{2}-\d{2}/.*png)表达式应该有效 (/d/.*?\.png) 好象也可以了。。 我只看到了一堆数字,好晕 本帖最后由 文白 于 2009-6-22 08:21 编辑
1.((?:/\w+)+\.png),专项 png 格式
2.((?:/\w+)+\.[\w]+),支持 多后缀名(可以配合一些限定使用)
3.<[^<>\r\n]*>([\w\W]*?)<\s*/[^<>\r\n]*>, 提取 标签内的InnerHtml
再使用2,就能完成.
$z = '<script type="text/javascript">' & @CRLF & _
'var picArr ="/d/file/comic/2007-08-22/fb9f4dbcfb78192fca3648397322cf2b.png|/d/file/comic/2007-08-22/cf04b87fd3fdd5fb86d4fc4bf069254a.png|/d/file/comic/2007-08-22/766b32085b6c6a16a46df67b0e71046c.png|/d/file/comic/2007-08-22/7291df5dfd7b7fcc6ca46da290579708.png|/d/file/comic/2007-08-22/29c020d37387bc2c03dcd9bd0cfac7a2.png|/d/file/comic/2007-08-22/f2b626e9817acd2c5c77d8235bef693d.png|/d/file/comic/2007-08-22/5555c3e219ad41c25dab856eb45d3e9e.png|/d/file/comic/2007-08-22/91f80a87cb9bbaa6adb1a99a23f55fa4.png|/d/file/comic/2007-08-22/496e2a2a4599950983c80ae60a8934cd.png|/d/file/comic/2007-08-22/a06b3544ce1899b8c28813dc3baad66d.png|/d/file/comic/2007-08-22/4e5f68ba0465c2d03084cfd653e0ad4b.png|/d/file/comic/2007-08-22/6cb6b8ed8eaca6a00f78d933cfc37474.png|/d/file/comic/2007-08-22/a70a8022d32ebf15c6033cd029a4f90e.png|/d/file/comic/2007-08-22/ec85874c6dde571e184933dfc49ee8cd.png|/d/file/comic/2007-08-22/08c6a15679f14f17d1b1ab47e4329b34.png"' & _
'</script>'
$f = StringRegExp($z, '(?U)(?i)/d.+png', 3, 1)
For $i = 0 To UBound($f) - 1
MsgBox(0,0,$f[$i])
Next
领教了!!:face (35): 学习一下。。
页:
[1]