和RegExp都定义了使用正则表达式进行强大的模式匹配和文本检索与替换的函数
用途:解决以上等问题,主要是用于验证客户端的输入的数据,当用户填写完表单后执行某些操作(比如点击提交按钮),表单的数据就会发送到服务器端...handsome/));// ["handsome", index: 15, input: ""chuanchuan is handsome man,chuanchuan川川是一个全宇宙最帅的男人""]
当不匹配时...";
var pattern = /[0-9]/; // [0-9]使用字符集合区间[],并用连接符-横岗
console.log(pattern.test(str));//true
当不匹配时,则返回...));// true
当不匹配时:
var str = ""; // 由于没有字符
var parttern = /^0-9/;
console.log(pattern.test(str)...code", index: 0, input: "codeinnode"]
从头开始匹配,当没有时,有一个字符不匹配时,就会返回null
var str = "coceinnode";
var pattern