小修复正则表达式以获取字符串的数字序列

I am trying to get the numbers sequence from the below line.

<div data-cid="8558641" class="clsfd_list_row_group">

I am doing this withous any luck

preg_match_all('!<div data-cid="\/(.*?)\/" class="clsfd_list_row_group">!is', $str, $urls);

What I am doing wrong?

try with:

<div data-cid="(.*?)" class="clsfd_list_row_group">

The "\/(.*?)\/" is looking for something more like "(content)" but tere is not braces in your example input.

You could easily do it with an xpath query:

<?php

$data = <<<DATA
<div>
    <div data-cid="8558641" class="clsfd_list_row_group">
    <div data-cid="12345" class="clsfd_list_row_group">
    <div data-cid="123" class="clsfd_list_row_group">
</div>
DATA;


$dom = new DOMDocument();
$dom->loadHTML($data);

$xpath = new DOMXPath($dom);

$cids = $xpath->query("//div[@class='clsfd_list_row_group']/@data-cid");
foreach ($cids as $cid) {
    echo $cid->nodeValue . "
";
}
?>

This outputs 8558641, 12345 and 123, see a demo on ideone.com.