Yahoo!上的正则表达式管道 [英] Regular expression on Yahoo! pipes
问题描述
我正在与 Yahoo! ,我用一些正则表达式击中了墙.现在,我熟悉Perl的正则表达式,但规则在Yahoo!中似乎有所不同.管道.
I'm fooling around with Yahoo! pipes and I'm hitting a wall with some regular expression. Now I'm familiar with regular expressions from Perl but the rules just seem to be different in Yahoo! pipes.
我正在做的是获取一个页面并将其转换为提要,我的正则表达式用于从HTML剥离链接,效果很好,但是我想成为< i>中的标题; 标记仅输出原始文本.
What I'm doing is fetching a page and trying to turn it into a feed, my regex for stripping out the link from the HTML works fine but the title which I want to be what was in <i> tags just outputs the original text.
在Perl和此在线正则表达式测试器上匹配的示例文本:
< a rel ="nofollow" target ="_ blank" HREF ="http://changed.to/protect/the-guilty.html">< i>收费Fi Fo Fun"(英语)/i</a> (另请参见此其他网站< a rel ="nofollow" target ="_ blank" href ="http://stackoverflow.com"> Nada</a>)此处还有一些其他文字
<a rel="nofollow" target="_blank" HREF="http://changed.to/protect/the-guilty.html"><i>"Fee Fi Fo Fun" (English Man)</i></a> (See also this other site <a rel="nofollow" target="_blank" href="http://stackoverflow.com">Nada</a>) Some other text here
推荐答案
RegEx作为标题:
RegEx for the title:
(?i).*?<i>([^<]*).* [ ] g [x] s [ ] m [ ] i
链接的正则表达式:
(?i).*?href="([^"]*).* [ ] g [x] s [ ] m [ ] i
不区分大小写的复选框似乎已损坏.幸运的是,您可以用(?i)
代替,效果很好.
Somehow the case-insensitive checkbox seems broken. Luckily you can substitute with (?i)
, which works nicely.
这是一个不错的web2.0版本的工具,用于测试正则表达式,其中包括: RegExr .但是由于某种原因,它仍然是beta. ;-)
Here is a nice web2.0-ish tool to test regular expressions with: RegExr. But for some reason it's still beta. ;-)
这篇关于Yahoo!上的正则表达式管道的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!