$re = '/(\d{6}\_\d{9})\=.*(gurlan,danu)/mi';
$str = '[7384] [Birthdays]
[7384] 180528_201747263=198202141300
[7384] 180528_210749326=19840222
[7384] 180528_211723352=19831207
[7384] 180528_211845500=201607072350
[7384] 180528_212024116=19591231
[7384] 180528_212038465=19590323
[7384] 180528_213357273=19590811
[7384] 180528_213701342=19780608
[7384]
[7384] [NameSurname]
[7384] 180528_201747263=Gurlan V. Vasile aka. Licuta
[7384] 180528_210749326=Gurlan (Enea) V. Maria aka Mariana
[7384] 180528_211723352=Danu (Gurlan) F. Oana Nicoleta aka. Nikol
[7384] 180528_211845500=Gurlan V. Rebecca-Ioana
[7384] 180528_212024116=Gurlan P. Vasile
[7384] 180528_212038465=Nucu (Gurlan) N. Maria
[7384] 180528_213357273=Bogdan (Danu) G. Elena
[7384] 180528_213701342=Enea D. Ioan Dorin
';
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