English 中文(简体)
收到载有关键词的URL
原标题:Regex to get a URL containing a keyword

由于缺乏抗逆转录病毒器,Im利用ATOM的饲料偷窃用户照片的信息。

这正是《刑法》所认为的:

<entry>
  <id>ID</id>
  <published>Date Published</published>
  <updated>Date Updated</updated>
  <link type="text/html" rel="alternate" href="http://www.redbubble.com/link/to/post"/>
  <title>Title</title>
  <content type="html">
    Blah blah blah stuff about the image..
    &lt;a href="http://www.redbubble.com/products/configure/config-id"&gt;&lt;img src="http://ih1.redbubble.net/path-to-image" alt="" /&gt;
  </content>
  <author>
  <name>Author Name</name>
  <uri>http://www.redbubble.com/people/author-user-name</uri>
  </author>
  <link type="image/jpeg" rel="enclosure" href="http://ih0.redbubble.net/path-to-the-original-image"/>
  <category term="1"/>
  <category term="2"/>
</entry>

基本上采用格外法......我如何在内容标的链接中找到href 的财产?

One thing we know for sure is it will always have configure in the path i.e. http://somesite.com/**configure**/id

因此,基本上,我只需要找到LURL,把整个东西混为一谈。

最佳回答

感谢你的慷慨解答,但我的同事却为我找到了答案!

这是最后使用:

/http://([^"/]*/)*configure/([^"]*)/

(Ruby regex by the way)

问题回答

下面的栏目将根据您的要求提取原始内容。 样本代码似乎在发挥作用。

href="(w[^"]+/configure/w[^"]+)

无论你使用什么方案语言,都不会试图把整个东西与一个reg子混在一起。 利用XML教区首先提取href=> >> >。 然后,可以肯定的是,使用一种规章来确保《URL》包含configure

As @KARASZI commented, XPath is another good approach.

如果你必须利用监管部门来尝试:

href="(?=[^"]*configure)([^"]*)

rubular.com

我正在利用一个头目来发现它是否含有混淆。





相关问题
how to represent it in dtd?

I have two element action and guid. guid is a required field when action is add. but when action is del it will not appear in file. How to represent this in dtd ?

.Net application configuration add xml-data

I need to add xml-content to my application configuration file. Is there a way to add it directly to the appSettings section or do I need to implement a configSection? Is it possible to add the xml ...

XStream serializing collections

I have a class structure that I would like to serialize with Xstream. The root class contains a collection of other objects (of varying types). I would like to only serialize part of the objects that ...

MS Word splits words in its XML format

I have a Word 2003 document saved as a XML in WordProcessingML format. It contains few placeholders which will be dynamically replaced by an appropriate content. But, the problem is that Word ...

Merging an XML file with a list of changes

I have two XML files that are generated by another application I have no control over. The first is a settings file, and the second is a list of changes that should be applied to the first. Main ...

How do I check if a node has no siblings?

I have a org.w3c.dom.Node object. I would like to see if it has any other siblings. Here s what I have tried: Node sibling = node.getNextSibling(); if(sibling == null) return true; else ...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml