$re = '/(3[\s=\\\\.-]*[47][\s=\\\\.-]*[0-9](?:[\s=\\\\.-]*[0-9]){12})|(5[\s=\\\\.-]*6[\s=\\\\.-]*0[\s=\\\\.-]*2[\s=\\\\.-]*2[\s=\\\\.-]*[1-5][\s=\\\\.-]*[0-9](?:[\s=\\\\.-]*[0-9]){9}|(5[\s=\\\\.-]*6[\s=\\\\.-]*1[\s=\\\\.-]*0)[\s=\\\\.-]*[0-9](?:[\s=\\\\.-]*[0-9]){11})/m';
$str = '341234567890123
5602211234567890
5610123456789012
341\\23 4567890123
56-0 2211234567890
561=01 23\\456789012
';
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