PHP Code Example:
<?php
$sourcestring="your source string";
preg_match_all('/\b([0-9]{15})\b/',$sourcestring,$match);
echo "<pre>".print_r($match,true);
?>
$matches Array:
(
[0] => Array
(
[0] => 398639164013360
[1] => 398639164013377
[2] => 398639164013384
[3] => 398639164013391
)
[1] => Array
(
[0] => 398639164013360
[1] => 398639164013377
[2] => 398639164013384
[3] => 398639164013391
)
)
\b is problematic to use, since [a-zA-Z_] are in \w as well as [0-9] so if you have numbers like this:
A398639164013360 or 398639164013360A they will not be found, not sure if that's an issue for you. If that is an issue an alternate pattern to use:
PHP Code Example:
<?php
$sourcestring="your source string";
preg_match_all('/(?<=^|\D)[0-9]{15}(?=\D|$)/',$sourcestring,$match);
echo "<pre>".print_r($match,true);
?>
Note that the capture group 1 is not necessary as you can reference $match[0] to access the same data, I eliminated capture group 1 from the last pattern.