Regex seems unacceptable to me for such a simple comparison.
If you don't have identifier tags around the line, you can simply do
echo trim(strrchr($xml, ':'), ':');
If they are, you can use
$xml = '<id>tag:search.twitter.com,2005:22204349686</id>'; echo filter_var(strrchr($xml, ':'), FILTER_SANITIZE_NUMBER_INT);
strrchr returns :22204349686</id> , and the filter_var part separates everything that is not a number.
source share