^(?=.*[A-Z])(?=.*_)(?=.*\d)^(?=.*[a-z]).{7,20}$ (?=.*[A-Z]) :必须包含大写字母一个 转载于:https://www.cnblogs.com/eason-d/p/9019723.html