Parsing og: tags with ColdFusion regex -


If you use regex (and Cold Fusion 9 +) from html (HEL), open the graph Removing / Matching,

And the hardest thing is to cover both the possible forms of tag structure in the following examples:

  & lt; Meta property = "og: type" content = "website" /> & Lt; Meta content = "website" property = "og: type" />   

So far I have received this:

    

It matches both links, however only the content bit has been returned with it in the first type. And the content is something that I need.

Just to make it clear at all, the desired output should be an array with all OG tags (they can be 'type, image, author, description etc.). . This means that it should be flexible and not based on OG: type the example alone.

Obviously, the ideal output tag will have a straight with the first column of name, and the second contains the value (content) but it can be achieved with post processing and the tag itself Is not important for.

Cheers, Simon

then you ['og: author', 'og : Type ',' og: image '...] like an array?

Like a regex og: ([\ w] +)

This should start with you if you have duplicate if you have the same og Is: foo meta tag.

You can also look for help in parsing HTML for yourself. This makes it very easy



Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -