Html的正则表达式
来源:互联网 发布:阿里云网站免费模板 编辑:程序博客网 时间:2024/04/30 15:27
这个是我们经常需要用到的.所以做了一个:
/*
* Main.java
*
* Created on 2006年12月7日, 上午10:43
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package regex;
/**
*
* @author longronglin
*/
import java.util.regex.*;
public class Main
{
/** Creates a new instance of Main */
public Main()
{
}
/**
* @param args the command line arguments
*/
public static void main(String[] args)
{
String htmlStr = "<table><br>this is a test</br></table>";
String patternString = "(<+[a-z//s]+>)|(</+[a-z//s]+>)";
Pattern pattern = Pattern.compile (patternString);
Matcher matcher = pattern.matcher(htmlStr);
while(matcher.find ())
{
int start = matcher.start();
int end = matcher.end();
String mache = htmlStr.substring(start,end);
System.out.println (start);
System.out.println (end);
System.out.println (mache);
}
System.out.print ("success");
}
}
结果:
init:
deps-jar:
Compiling 1 source file to D:/fenci/regEx/build/classes
compile:
run:
0
7
<table>
7
11
<br>
25
30
</br>
30
38
</table>
success
生成成功(总时间:1 秒)
- Html的正则表达式
- c#中过滤html的正则表达式
- 匹配 html 标签元素的正则表达式
- C# 去掉HTML标记的正则表达式
- HTML相关的正则表达式工具类
- 去除HTML的正则表达式函数
- 正则表达式 提取 html 标签的内容
- DW里的html使用正则表达式
- Lua解析Html的正则表达式Demo
- 提取html中table的正则表达式
- 正则表达式 过滤html
- 解析HTML正则表达式
- 解析HTML正则表达式
- html正则表达式总结
- html 正则表达式
- 正则抓取html表达式
- 常用HTML正则表达式
- html 正则表达式 相关
- Linux下PCI设备驱动程序开发
- 《Series40可扩展应用程序开发》学习笔记
- SecureCRT传输数据方法
- Struts常见错误及原因
- visual source safe让人要崩溃了
- Html的正则表达式
- 基于Web的权限管理框架之功能规格
- 嵌入式linux移植过程中“串口终端”问题解决方案
- 电子工程师秘籍-怎样做一块好的PCB板
- [.net]标准 3DES 加密/解密
- linux内核wait_queue深入分析
- 好玩的问题From april_ii
- 快石沉大海,给个答案.. 关于"我常问的技术面试题"
- uClinux下使用MTD和jffs2方法