jsoup解析html 在正则报的错,不知道什么错

小谷同学_W 发布于 2017/03/13 11:26
阅读 178
收藏 0

我的正则是这个

String Regular = "<tr height=\"25\">([^>]*>){3}(?<StockCode>[^<]*)([^>]*>){3}(?<StockName>[^<]*)([^>]*>){6}(?<trade>[^<]*)([^>]*>){3}(?<UpToPrice>[^<]*)([^>]*>){2}(?<ZF>[^<]*)([^>]*>){2}(?<SZ>[^<]*)([^>]*>){2}(?<SYL>[^<]*)([^>]*>){2}(?<ZF3>[^<]*)([^>]*>){2}(?<ZF_halfyear>[^<]*)([^>]*>){2}(?<je>[^<]*)([^>]*>){2}(?<ddx>[^<]*)([^>]*>){2}(?<ddy>[^<]*)([^>]*>){2}(?<ddz>[^<]*)([^>]*>){2}(?<zdl>[^<]*)([^>]*>){2}(?<tcl>[^<]*)([^>]*>){2}(?<ddxh>[^<]*)([^>]*>){2}(?<ddxl>[^<]*)([^>]*>){2}(?<tdc>[^<]*)([^>]*>){2}(?<ddc>[^<]*)([^>]*>){2}(?<zdc>[^<]*)([^>]*>){2}(?<xdc>[^<]*)([^>]*>){2}(?<hyd>[^<]*)([^>]*>){2}(?<dsb>[^<]*)([^>]*>){2}(?<tdmr>[^<]*)([^>]*>){2}(?<damc>[^<]*)([^>]*>){2}(?<ddmr>[^<]*)([^>]*>){2}(?<ddmc>[^<]*)([^>]*>){2}(?<zdmr>[^<]*)([^>]*>){2}(?<zdmc>[^<]*)([^>]*>){2}(?<xdmr>[^<]*)([^>]*>){2}(?<xdmc>[^<]*)([^>]*>){2}(?<hsl>[^<]*)([^>]*>){2}(?<lb>[^<]*)";

String Regular = "<tr height=\"25\">([^>]*>){3}(?<StockCode>[^<]*)([^>]*>){3}(?<StockName>[^<]*)([^>]*>){6}(?<trade>[^<]*)([^>]*>){3}(?<UpToPrice>[^<]*)([^>]*>){2}(?<ZF>[^<]*)([^>]*>){2}(?<SZ>[^<]*)([^>]*>){2}(?<SYL>[^<]*)([^>]*>){2}(?<ZF3>[^<]*)([^>]*>){2}(?<ZF_halfyear>[^<]*)([^>]*>){2}(?<je>[^<]*)([^>]*>){2}(?<ddx>[^<]*)([^>]*>){2}(?<ddy>[^<]*)([^>]*>){2}(?<ddz>[^<]*)([^>]*>){2}(?<zdl>[^<]*)([^>]*>){2}(?<tcl>[^<]*)([^>]*>){2}(?<ddxh>[^<]*)([^>]*>){2}(?<ddxl>[^<]*)([^>]*>){2}(?<tdc>[^<]*)([^>]*>){2}(?<ddc>[^<]*)([^>]*>){2}(?<zdc>[^<]*)([^>]*>){2}(?<xdc>[^<]*)([^>]*>){2}(?<hyd>[^<]*)([^>]*>){2}(?<dsb>[^<]*)([^>]*>){2}(?<tdmr>[^<]*)([^>]*>){2}(?<damc>[^<]*)([^>]*>){2}(?<ddmr>[^<]*)([^>]*>){2}(?<ddmc>[^<]*)([^>]*>){2}(?<zdmr>[^<]*)([^>]*>){2}(?<zdmc>[^<]*)([^>]*>){2}(?<xdmr>[^<]*)([^>]*>){2}(?<xdmc>[^<]*)([^>]*>){2}(?<hsl>[^<]*)([^>]*>){2}(?<lb>[^<]*)";

然后爆了这么一个错

Exception in thread "main" java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 259

加载中
0
刘邵博
刘邵博

你这要是解析什么,好繁琐的正则

小谷同学_W
小谷同学_W
http://www.shdjt.com/flsort.asp?lb=993505这个网页的数据
0
蓝风970655147
蓝风970655147

厉害了, 你这正则是工具生成的吗?

返回顶部
顶部