[英]How to get this regular expression
I have this piece of code: 我有这段代码:
<a href="http://www.fnac.pt/Memorial-do-Convento-Texto-em-Analise-Varios/a242166" class="fontbigger">Memorial do Convento - Texto em Análise</a>
...and I want to get this part: ...我想得到这一部分:
Memorial do Convento - Texto em Análise
How do I do it? 我该怎么做? I have tried this:
我已经试过了:
<a href="[^<]+" class=".+">(.+)</a>
...but the first [^<]
doesn't work cause it recognizes only this: ...但是第一个
[^<]
不起作用,因为它只能识别以下内容:
http://www.fnac.pt/Memorial-do-Convento-Texto-em-Analise-Varios/
Tried out this regex and it worked 尝试了这个正则表达式并有效
>([^<>]+)<
>([^ <>] +)<
However parsing HTML with regex isn't the best option 但是,使用正则表达式解析HTML并不是最佳选择
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.