javascript全量匹配屏蔽词
2024-10-21 09:52:47
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<script>
var sel = '白'
var arr = ['白色', '小白', '红色', '紫色', '黑色']
for (let index = ; index < arr.length; index++) {
var txt = new RegExp(sel);
if(txt.test(arr[index])) {
console.log(arr[index])
} else {
console.log('不包含')
}
}
</script>
</body>
</html>
最新文章
- bzoj2702[SDOI2012]走迷宫
- IOS的Crash情况在Crashlytics平台上统计解决方案的一点遗憾(截止到2015年6月14日)
- 树莓派搭建安装mysql
- 【BZOJ-4213】贪吃蛇 有上下界的费用流
- Linux 中常见的命令行,持续更新
- MyString(重写String)
- Sqoop安装配置及数据导入导出
- xxx is not in the sudoers file.This incident will be reported.的解决方法
- 《Linux命令行大全》系列(一、shell是什么)
- ecstore生成二维码
- SQL查询 addScalar()或addEntity()
- Java 网络编程(六) 使用无连接的数据报(UDP)进行通信
- 不停止MySQL服务增加从库的两种方式【转载】
- Robotframework-Appium系列:安装配置
- ./init的含义
- vue之render基本书写方法
- listcard记录
- django ---forms组件
- 翻译 – 从心理学角度看UX设计
- 06 Locking and Latching
热门文章
- 一双木棋(chess)
- [杂题]:B/b(二分答案)
- 团队冲刺DAY1
- Intel processor brand names-Xeon,Core,Pentium,Celeron----Xeon
- sql server中实现mysql的find_in_set函数和group_concat类似功能的讲解
- 关系型数据库MySQL(三)_触发器
- spring boot 尚桂谷学习笔记10 数据访问02 mybatis
- C# 笔记 获取程序当前目录
- 安装vue开发环境→安装淘宝镜像的时候报错
- 牛客网练习赛 2 烟花(概率dp)