I am new to iphone development. I am using RegexkitLite framework to parse and retrieve the particular content from the Html source. I want to retrieve the content in the attribute tag. How开发者_运维百科 should I give regex to achieve it? The Tag is
<a href="http://www.stackoverflow.com" class="11-link-dkred-bold">This is stack overflow HTML</a>
I want to retrieve href content and value between the and tag. Please help me out.
Its recommended to use a HTML parser for such jobs.
If you want to use a regex you can try this:
<a href\s*=\s*"([^"]*)">([^<]*)</a>
First group will capture the href attribute value and second group will capture the text between the starting and closing tag.
I finally got the output by using
<a href=([^<]*) class=\"11-link-dkred-bold\"><b>([^<]*)</a>"
I have used \ before the double quotes.Just like printing the " in print statement.
精彩评论