ByteNote LogoByteNote

Navigation

  • Blog
  • 工具

    © 2025 ByteNote. All rights reserved.

    JS 正则则必须同时包含字母大写和小写和数字和特殊字符

    Dec 22, 20227 min read
    function checkPassword(password) {
      // 这个正则表达式表示:必须包含大小写字母、数字和特殊字符,且同时包含大写和小写字母
      const pattern = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[@$!%*#?&])[A-Za-z\d@$!%*#?&]*$/;
      return pattern.test(password);
    }
    
    console.log(checkPassword('AbcdefgH123#')); // true
    console.log(checkPassword('abcdefgH123#')); // false
    
    

    相关文章

    解决 next.js document is not defined

    该代码片段通过检查`window`对象是否存在来解决在next.js中使用`document`时出现的“document is not defined”问题。

    处理异步事件的框架 Combine 三个核心概念

    Combine 框架通过 Publisher、Subscriber 和 Operator 三个核心概念,提供了一种处理异步事件流的强大机制。

    CentOS 如何修改vps上时区为北京时间?

    通过SSH登录CentOS VPS,安装tzdata,选择并设置时区为"Asia/Shanghai",然后检查时间以确认时区已成功更改为北京时间。

    SwiftUI EmptyView 的使用代码演示

    SwiftUI 中的 EmptyView 是一个用于在需要返回视图但不需要实际内容时作为占位符的空视图。

    关闭SELINUX服务

    要关闭SELinux服务,需以root身份登录终端,设置SELinux为permissive模式,修改配置文件并重启系统,但此举可能降低系统安全性。