$re = '/assignments$/m';
$str = '1.) https://beta-qa.pearson.com/iie-api/courses/5daa3022e4b0ef7dce37acec/assignments
2.) https://beta-qa.pearson.com/iie-api/courses/5daa3022e4b0ef7dce37acec/assignments/984fa00d-d002-4826-80f4-76d1267e3aaa
3.) https://beta-qa.pearson.com/iie-api/courses/5daa3022e4b0ef7dce37acec/assignments/984fa00d-d002-4826-80f4-76d1267e3aaa/assignments';
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