The Pakistani government has been trying to regain control of the Swat Valley in recent months , after militants regrouped there from other Pakistani border areas with Afghanistan .