Php regular matches doc or pdf extension

php regular match doc or pdf extension
match doc or pdf extension
1212.doc
1419421.pdf

in the following document
  preg_match_all("|(.*).doc|U", $namelist[$j], $nn[$j]);

previously used is | (. *). Doc | U, which can only match doc,. Now I want both pdf and doc to match. How can I rewrite

?
Jun.16,2021

"/ (. *)\. B (doc | pdf)\ b /"

or

"(. +?)\. (pdf | doc)"


^. *?. (pdf | doc) $


< H2 > use the pathinfo method in conjunction with in_array < / H2 >
  
(. *). (doc | pdf)
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b34ba1-2bf2e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b34ba1-2bf2e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?