$re = '/.*\.pdf(\?.+)?$/m';
$str = 'https://c4-zeus.s3.amazonaws.com/dev-budget-change-request/LITHHONDOX/1630503044445-202098.pdf?AWSAccessKeyId=AKIAWOEQ34ZOEXAJAK7F&Expires=1630512421&Signature=sxAqWQokLxnRqlvh16Ahl7B2EU8%3D
https://c4-zeus.s3.amazonaws.com/dev-budget-change-request/LITHHONDOX/1630503044445-202098.pdf
https://c4-zeus.s3.amazonaws.com/dev-budget-change-request/LITHHONDOX/1630503044445-202098.pdf.pdd';
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