<!-- publish_helper name='原始正文' p_id='6' t_id='12' d_id='5225186' f_id='41' --><p> 青少年<p><div style="text-align:center"><img alt="刘继在比赛中" src="http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" /></div><div style="margin: 5px 0; text-align: center;">刘继在比赛中</div><p> 陈彦p>
<!-- publish_helper_end -->
上面是html,我想读取中间的文本,可不可以根据“<!-- publish_helper ”“<!-- publish_helper_end -->”来取???
可以的话正则怎么去?
对了,图片路径怎么取?
谢谢!小弟正则不懂...
<!-- publish_helper_end -->
上面是html,我想读取中间的文本,可不可以根据“<!-- publish_helper ”“<!-- publish_helper_end -->”来取???
可以的话正则怎么去?
对了,图片路径怎么取?
谢谢!小弟正则不懂...
解决方案 »
- 求解释sql语句 急
- 求助:在线客服设计原理
- 和数据库没有关系的分页显示。。。。?
- 如何在ascx中给page的viewstate付值?
- GridView 绑定问题 在线等!
- 博客中如何传替多个用户名或者ID---顶者有分
- 求一正则表达式,例如:要求输入非负的:32.98 或者32 改如何写这一正则表达式。。。???
- 下面的数据如何显示!
- 请问我有一个datarow...我想把我这个datarow中的数据插入到数据库中...(数据库和这个row的结构相同)...请问怎么办....还有我想用这个row
- entity ef model first 模型序列化的问题
- C# Gridview表头中加入的Checkbox后 CheckedChanged事件不执行
- 怎么取得listview里面的TextBox的值
最后的结果<p> 青少年<p><div style="text-align:center"><img alt="刘继在比赛中" src="http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" /></div><div style="margin: 5px 0; text-align: center;">刘继在比赛中</div><p> 陈彦p>
<!-- publish_helper name='原始正文' p_id='6' t_id='12' d_id='5225186' f_id='41' -->
有时候会是<!-- publish_helper name='原始正文' -->
那正则写一个可以么?
Regex regTag = new Regex(@"<[^>]*>");
Match m = regBody.Match(yourStr);
if (m.Success)
{
richTextBox2.Text = regTag.Replace(m.Value, "");
}
Match m = regBody.Match(yourStr);
if (m.Success)
{
richTextBox2.Text = m.Groups[1].Value;
}
string content = regex.Replace(content ,"");
超链接<a href="**">好</a>
有时候超链接是<a href="***" style="****">好</a>
超链接前面和后面都有代码,我只想取消了超链接的html标签,但是“好”要留下...请问正则怎么写!!
谢谢!
我要的是
<img alt="刘继在比赛中" src="http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" />
要改为
<img alt="刘继在比赛中" src="本项目的一个文件的路径/2010929101036.jpg" style="border:px solid #000000" title="刘继在比赛中" />
但是有的链接有style有的没有
谢谢!!!
Regex reg = new Regex(@"(?is)<a[^>]*>(.*?)</a>");
string result = reg.Replace(yourStr, "$1");
richTextBox2.Text = result;
string test = "<img alt=\"刘继在比赛中\" src=\"http://i1.sinaimg.cn/ty/2010/0929/2010929101036.jpg\" style=\"border:px solid #000000\" title=\"刘继在比赛中\" />";
Regex reg = new Regex(@"(?is)(?<=<img[^>]*?src=(['""]?))[^'""\s>]*(?=/[^'""\s>/]+\1[^>]*>)");
string result = reg.Replace(test, "本项目的一个文件的路径");
richTextBox2.Text = result;
foreach (Match m in mc)
{
richTextBox2.Text += m.Value + "\n";
}这个对不??
你给我的能够替换为<img src="本地路径+图片本身的名称">
但是现在图片还没有保存到本地,我想先获取网络的图片路径“http://www.baidu.com/images/1.jpg”,我写好了保存本地的方法了,就差网络的路径了 ....