A simple regular, ask
PHP Code
$content = <<
<>
- <!-->
- <! Doctype>
html; $parr = "/href=\" \/html5\/(. *) \ "/I";p reg_match_all ($parr, $content, $result); Var_dump ($result);
The results match to the following
String ("tag_comment.asp" title= "HTML 5")
String ("Tag_doctype.asp")
The first one also contains the title property. My intention is to take the value of the href attribute only, what should I do?
------Solution--------------------
$parr = "/href=\" \/html5\/(. *?) \ "/i";
Array (2) {
[0]=>
Array (2) {
[0]=>
String "href="/html5/tag_comment.asp ""
[1]=>
String "href="/html5/tag_doctype.asp ""
}
[1]=>
Array (2) {
[0]=>
String ("Tag_comment.asp")
[1]=>
String ("Tag_doctype.asp")
}
}
------Solution--------------------
I've been using this and I've forgotten where to find it. Anyway, I don't understand, it only works.
PHP Code
'/(.+?) <\/a.*?>/sim '