Regex 测试 Fill
填空题 中等
题目
Fill in 空白到 测试如果 `text` 包含 at 最少 one digit.
代码
const text = "abc123";
const hasDigit = /\d/.___(text);
console.log(hasDigit);
提示
Use regex 方法那个返回真/假.
解释
RegExp.测试(字符串) 返回 真 如果字符串 matches 模式, 假 否则. /\d/.测试("abc123") is 真 because the string contains at least one digit. \d matches any digit character (0-9). The result 真 是 printed.
相关资源
相关课程
- JavaScript 数据类型
学习关于 regular 表达式.
相关工具
- Regex Tester
测试 regular 表达式.
查阅不认识的术语
新手友好的术语表用大白话解释编程术语——变量、函数、DOM、Promise 等等。
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。
动手做项目
通过引导式项目应用所学,含起始代码与解决方案。