True, though GP made a subtle mistake in not moving one space into the optional capture group. It should have been for example /Yes,( Prime)? Minister/, lest it were to match
Yes, Prime Minister
Yes, Minister