. *? +href\s*=\s*"(^"+)"^>*>(^ Text doot More Text." />
Following your example, this regex will find "mymplogk.blogspot.com/2011/03/h_25.html" and "Text": $regex_pattern = '/+class\s*=\s*\'"post-title entry-title\'"^>*>. *? +href\s*=\s*"(^"+)"^>*>(^ Text doot More Text.
Thanks! It can display any results but I think this is because has single quotes on page source, not double. Please can you make me a modification on your pattern?
I can't escape the characters correctly by myself. This is what I had before $regex_pattern = "/(^`*? )/"; – mtopia Mar 24 at 23:41 (I don't know if this is a good answer, but +1 for polishing the edits!) – Arjan Mar 25 at 11:18.
Don't use regex to parse HTML. It's a bad idea. Use an HTML/XML parser.
Since you are using PHP, you can try using PHP Tidy or DOMDocument. It will make your life much easier.
I don't think Tidy is really appropriate here -- it offers only the most basic DOM traversal. DOMDocument + XPath is preferable, especially in the context of the OP's requirements. He's essentially described an xpath query something like //h3@class="post-title entry-title"/a/@href – Frank Farmer Mar 24 at 23:16 @Frank I think it depends on what he wants to use.
XPath would, of course, be the best. But I find Tidy useful if I'm getting HTML from some other source. I use Tidy to clean up the HTML before I parse it.
– Vivin Paliath Mar 24 at 23:18 there I have managed and got the link! Thank you! But how can I get the text also?
– mtopia Mar 24 at 23:45 @Giannis What are you using? Tidy or DOMDocument? If you're using DOMDocument, you should be able to obtain a reference to a DOMNode object.
This object has a $textContent property which should give you what you need. See DOMNode. – Vivin Paliath Mar 24 at 23:52 I am using Frank's method.... – mtopia Mar 247 at 0:12.
I would recomend you to use DOMDocument and XPath to extract the url from the page instead of using regexp. This tutorial gives you some starters how to use xpath and dom. merchantos.com/blog/makebeta/php/scrapin... edit: If you use firebug-addon in firefox, you can inspect your element on the page, and copy it's xpath.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.