A federal judge in Boston invalidated Trump administration regulations that sought to limit the length of stay for foreign students and journalists.…