I am checking for html tags in a file using this regex:
/<([a-zA-Z]+(-[a-zA-Z]+)?(.*)?)>/
The file is:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Title</title>
</head>
<body>
<div id="div">
<p class="class">Hello World</p>
</div>
</body>
</html>
Here is the result: (which is what i need)
string(4) "html"
string(4) "head"
string(20) "meta charset="utf-8""
string(18) "title>Title"
string(4) "body"
string(12) "div id="div""
string(30) "p class="class">Hello World"
string(14) ""
string(7) ""
string(7) ""
There's some "empty" strings that do not have content inside of them, but empty() returns false, and strlen() does not return 0, what is this?
Aucun commentaire:
Enregistrer un commentaire