http://www.zu14.cn/2009/01/24/regex-image-width-height/
来源:互联网 发布:caffe安装教程 windows 编辑:程序博客网 时间:2024/06/05 09:28
在HTML代码中,img的写法大致如下:
<img src=”…” alt=”…” width=”…” height=”…” />
我们利用正则表达式来提取 width 和 height 的值:
string str = "<img src=/"/upload/1.jpg/" width=/"100/" height=/"80/">";string pattern = "width//s?=//s?/"(//d+)/"//s+height//s?=//s?/"(//d+)";System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);System.Text.RegularExpressions.Match m = regex.Match(str); if (m.Success){ string width = m.Groups[1].Value; //宽 string height = m.Groups[2].Value; //高 }
- http://www.zu14.cn/2009/01/24/regex-image-width-height/
- http://www.google123.cn
- http://www.angelrose.cn/
- http://www.cnzz.cn/
- http://www.newnew.cn/
- http://www.csai.cn/
- http://www.it8800.cn
- http://www.hao1973.cn
- http://www.dearming.cn
- http://www.wewill.cn/
- http://www.svnhost.cn/
- http://www.findgirlfriend.cn/
- http://www.8211.cn/
- http://www.proxyie.cn/
- http://www.vimer.cn/
- http://www.datakong.cn/
- http://www.trinea.cn/
- http://www.neuwak.cn/
- Resizeable Module Box
- 在 .NET 中创建快捷方式
- Gnome sort
- HP NC6400 拆机清灰过程(图文)
- 向上滚动代码,不是无缝的,老代码,放在这里备忘
- http://www.zu14.cn/2009/01/24/regex-image-width-height/
- samba的配置与管理
- 利用SqlDataAdapter复制数据行
- Comb sort
- NFS server/client configuration in Ubuntu
- 开源空间数据引擎MsSQLSpatial简介
- cab文件介绍及制作方法
- 学习ASP.NET中遇到的问题
- 读书笔记-《专业主义》的读后收获