$re = '/\<(\w+)(?:\s*|\>)?/m';
$str = '
<!DOCTYPE html>
<html lang="el" dir="ltr" class="no-js">
<head>
<meta charset="utf-8" />
<title>Radial</title>
<meta name="description" content="Η Radial σχεδιάζει και αναπτÏσσει websites, οÏγανώνει online καμπάνιες και δημιουÏγεί εταιÏικÎÏ‚ ταυτότητες." />
<meta property="fb:page_id" content="118981334805256" />
<meta property="fb:app_id" content="166019300145537" />
<!--[if lt IE 9]><script type="text/javascript" src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<script type="text/javascript">(function(H){H.className=H.className.replace(/\\bno-js\\b/,\'js\')})(document.documentElement);</script>
<link rel="stylesheet" type="text/css" media="screen" href="http://static.radial.gr/styles/screen.css?43614" />
<script type="text/javascript" src="http://use.typekit.com/ioa2dxy.js"></script>
<script type="text/javascript">try{Typekit.load();}catch(e){}</script?
<link rel="alternate" type="application/rss+xml" title="Τελευταία ÎÏγα" href="/feed/" />
</head>
<body id="home" class="">
<header id="main-header"><div class="wrapper">
<div id="logo"><a href="/"><img src="http://static.radial.gr/images/radial-logo.png" alt="Radial" /></a></div>
<nav id="main-nav">
<ul>
<li><a href="/projects/">ΈÏγα</a></li>
<li><a href="/profile/">Î Ïοφίλ</a></li>
<li><a href="/contact/">Επικοινωνία</a></li>
</ul>
</nav>
<nav id="lang-nav">
<span>EΛ</span>
<a href="/en/">EN</a>
</nav>
<br />
</div></header>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push([\'_setAccount\', \'UA-515952-44\']);
_gaq.push([\'_trackPageview\']);
(function() {
var ga = document.createElement(\'script\'); ga.type = \'text/javascript\'; ga.async = true;
ga.src = (\'https:\' == document.location.protocol ? \'https://ssl\' : \'http://www\') + \'.google-analytics.com/ga.js\';
var s = document.getElementsByTagName(\'script\')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php