RegExp-dotAll

那年仲夏 提交于 2020-01-24 00:07:00
//.不能匹配四个字节的utf16字符和行终止符\n,\r
console.log(/foo.bar/.test('foo\nbar')) //false

//dotAll
console.log(/foo.bar/us.test('foo\nbar')) //true

//如何判断正则是否启用了dotAll模式
const re = /foo.bar/s
console.log(re.dotAll) //true
console.log(re.flags)  //s

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!