20171213.1

来源:互联网 发布:好的收纳箱 知乎 编辑:程序博客网 时间:2024/05/21 11:02
<!doctype html><html lang="en"><head>    <meta charset="UTF-8">    <title>Document</title></head><body><script>    /*        找到a开头,c结尾,中间为1或2或3        [] 范围    */    // let str = "a1ca2ca3ca4ca5c";    // console.log(str.match(/a(1|2|3)c/g)); //trouble ?    // console.log(str.match(/a[123]c/g));    // console.log(str.match(/a(1)(c)/));    // console.log(str.match(/a[1-3]c/g));//根据   啊思可码  ASCII码表    let str = "aacabcaccadcaAcaBcaZca^c";    console.log(str.match(/a[a-z]c/gi));    console.log(str.match(/a[A-z]c/g));    console.log(str.match(/a[A-Za-z]c/g));//正确的姿势</script>   </body></html>