<?php $str="<b>1</b><b page=2>2</b><b page=3>3</b><b page=4>4</b><b page=5>5</b><b page=6>6</b><b page=7>7</b><b page=8>8</b><b page=9>9</b>"; preg_match_all("|>(.*?)</b>|", $str, $out); for ($l=0;$l<count($out[1]); $l++) echo $out[1][$l]."<br>"; ?>